|
Same replies as earlier...
|
|
|
|
|
You can use the function: SetUnhandledExceptionFilter to catch. Then use MiniDumpWriteDump to dump exception to a file.
|
|
|
|
|
...or you could use longjmp which should be portable.
|
|
|
|
|
Hello All,
I made a service which keep track of logon, logoff, lock and unlock notification.. I want to extract the logged on user name when user logged on, lock or unlock system.. So i'm using GetUserName in respective cases, but it returns me "SYSTEM" every time..
What could be the reason?
Thanks...
|
|
|
|
|
Maybe because your service executes under the SYSTEM account?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Have you looked at the ISensLogon interface?
"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
|
|
|
|
|
Environment.UserName will return the current user name
|
|
|
|
|
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;
|
|
|
|