|
Thanks Everyone, I now used WTSQuerySessionInformationA
|
|
|
|
|
I installed a simple (and quite old application) on Windows 7 (UAC is enable) and it is not saved a simple text file (a simple LOG file) on C:\ !
I'm sure that the problem is related on UAC because disabling it the program runs well.
So, how to bypass the UAC and have the permission to write that file?
I suppose it can be also difficult to manage the registry, there is also in this case some special procedure to use?
thanks...
Russell
|
|
|
|
|
|
your app needs the rights to write this file. Runas or the Elevation moniker is needed.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello folks!
The problem is as follows: our software relies on a 3rd party service. We noticed that this 3rd party service sometimes (on some computers sadly more than just sometimes) fails to startup correctly and it needs to be restarted to work with. This issue came up way too late for skipping to a different "platform" (so use another 3rd party's service) without having to do way too much work. As it seems, restarting the service "manually" fixes the problem. However, we can't expect our customers to do that every time our product doesn't work because of the 3rd party service not running correctly. We could try adding a program that runs and boot time or at the start of our product and restarts this service, however, you need to be an administrator to fiddle with it (and 99% of the users using the product will not be administrators). I was thinking of using CreateProcessAsUser[^], however, this would need the admin user's loginname and password every time, which won't do. So i was wondering if it was somehow possible, thorough some certificate or somesuch, to ask for the admin user's login information at install time (and later when this information changes thorough some setup program or automatically...) and then use it in following cases when the program is runned. Of course we could store the information in the registry or some file on the filesystem in a crypted-decryptable way but this would mean a HUGE security leak we just can't take.
Any ideas are welcome, thanks in advance...
p.s: and this should work on XP, Vista, Win7, ...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
Hi,
how to catch memory exception.
I am using delete[] operator for freeing memory.
The program hangs
Now i want to catch this exception.
|
|
|
|
|
Sakhalean wrote: how to catch memory exception.
Don't try. In almost all cases it's a bad idea. If the heaps corrupted handling the exception doesn't fix anything, it just makes things worse. Find the real problem, don't make new ones.
Steve
|
|
|
|
|
Are you even sure you get an exception if the program hangs?
|
|
|
|
|
No I want to catch this exception
without hanging the program
|
|
|
|
|
Do you know why the access violation is occurring? If not, what do you hope to achieve be catching it?
Steve
|
|
|
|
|
I am using three layer allocation of arrays of memory.
i want to free this memory and again i want to reallocate the memory
dynamically
|
|
|
|
|
Can you show some code and explain the fault more clearly.
Steve
|
|
|
|
|
My structure is like this:
-----------------------------
typedef struct
{
HTREEITEM* pParam;
int nCnt;
} MILPARAMETER;
typedef struct
{
MILPARAMETER* pMilParam;
HTREEITEM* pMessage;
int m_nMsgIndex;
int nCnt;
} MILMESSAGE;
typedef struct
{
MILMESSAGE* pAvionicsMsg;
MILMESSAGE* pMissionMsg;
HTREEITEM* pAvionicsTree;
HTREEITEM* pMissionTree;
CString *pStrAvionicsBus;
CString *pStrMissionBus;
int m_nAvoinicsCnt;
int m_nMissionCnt;
} MILLRUNAMES;
Now I want to dynamically allocate and deallocate the memory
for the pointer variables.
Allocation there is no problem for deallocation is the only problem.
How to deallocate this memory?
|
|
|
|
|
When posting code, please use the 'code' tag to format it properly.
Anyway, you still didn't post the real useful code: the part where you allocate and deallocate the memory. Without that, it will be very difficult to help you. I also fully agree with the other posters: it seems you don't really understand how to allocate and deallocate the memory properly and catching an exception in those circumstances without fixing the actual problem would be really crazy.
Furthermore, are you sure you want to use arrays of CString ? Do you want to store multiple strings ?
I also encourage you to take a look at std::vector or std::list, because it seems you want to work with arrays of varying size, in which case such a container would make things way more simple.
Additionally, I also encourage you to focus a bit more on encapsulation: as you are using C++, I would provide a constructor and destructor for your structures, which will be responsible to allocate and deallocate the memory properly. Also, the members would be private so that only the structure can allocate memory for the varialbes. This will make your code much more simple and less error prone.
|
|
|
|
|
Hi,
I have 3 and 4 layer of tree structures of variable sizes.
If you click on one node that type of record details should come from database. and that record will be filled in the controls of the dialog.
These layers are dynamic and the structure details i have already posted.
|
|
|
|
|
Did you actually have a look at the suggestions that were given to you or you just expect that somebody provides the solution on a silver plate to you ?
Did you look at the std::vector documentation ? What's the problem with using a vector ? Did you rewrite your code properly so that your allocations and deallocations are hidden in a class so that it is not spread across the whole program (aka encapsulate your data properly). As long as you don't show us precisely how the memory is allocated and deallocated, we won't be able to help. I suppose you didn't do it because it is too complicated because everything is spread across your code. One additional reason to try to encapsulate your data.
If you want help from us, you will need to read and try to understand what people are telling you, not expect a complete solution.
|
|
|
|
|
Sakhalean wrote: Now I want to dynamically allocate and deallocate the memory
for the pointer variables.
MILLRUNAMES.pAvionicsMsg = new MILMESSAGE; Sakhalean wrote: How to deallocate this memory?
delete MILLRUNAMES.pAvionicsMsg;
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Or, to be complete:
MILLRUNAMES.pAvionicsMsg = new MILMESSAGE[3];
delete[] MILLRUNAMES.pAvionicsMsg;
|
|
|
|
|
You haven't indicated where the problem is occurring. I'll help if I can, but I'm not going to do it for you.
Steve
|
|
|
|
|
Sounds like you've got a bug in your code. Concentrate on finding that rather than trying to paper over the cracks by catching an exception that may or may not exist.
Here's another thought - if you're playing with dynamically allocated arrays why aren't you using std::vector?
Cheers,
Ash
|
|
|
|
|
I have a DWORD and i want to convert it into a time format.
Eg. DWORD is = 41107ECE
I want it should be in format as = 2004/08/04 Wed 06:14:38 UTC
How can I do this conversion?
Plz help me.
Regards
Nikesh
|
|
|
|
|
Clearly that depends on the encoding of the date in the DWORD , which you haven't mentioned.
Steve
|
|
|
|
|
Nikesh Jagtap wrote: I have a DWORD and i want to convert it into a time format.
Assuming that you mean your DWORD is actually a time_t value then you can use one of the Time Management Routines[^].
It's time for a new signature.
|
|
|
|
|
This way:
char buf[0x20];
DWORD dw = 0x41107ECE;
time_t t = dw;
struct tm * ptime;
ptime=gmtime(&t);
strftime(buf,0x20,"%Y/%m/%d %a %H:%M:%S UTC\n",ptime);
printf(buf);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
CString sz;
sz.LoadString( HINSATANCE hin,UINT id);
How to achieve the above thing by using std::string instead of cstring???
Thanx.
|
|
|
|