|
Thank you for your hints, they helped me to find out that the actual problem seems to be a memory leak. So the actual reason was not the wrong parameter for the malloc (which also caused the memory to be exhausted), but the malloc seems to have corrupted the stack if there was no more memory available, and hence the value of the variable was no longer accurate. I will now try to verify this thesis, the fix itself will be obvious.
|
|
|
|
|
|
Hi,
please allow me to post a specific question here.
We have an application that consists of the exe and a service. This code is running on Win2k currently.
We have the job to migrate this code to Win7. The software is currently running as an adminsitrator (app and service). They should run on the account of a local(restricted) user.
The problem: the software uses mailslots for the communication between the app and the service. This works when both parts are started as administrator on Win7. It will not work when they both are started as a local user and not when the app is started on the account of a local user and the service as administrator.
In the error-case the function CreateFile() returns an INVALID_HANDLE_VALUE and GetLastError() returns a value of 5 (== ERROR_ACCESS_DENIED).
Whats wrong in our code?
Thanks.
August
PS: a link will be sufficient.
here is our code for creating the mailslot:
HANDLE mailSlotHandle =
CreateFile( GetClientMailslotName(),
GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH ,
NULL);
if( mailSlotHandle == INVALID_HANDLE_VALUE )
{
DWORD errorNumber = GetLastError();
and so on.
modified on Wednesday, April 21, 2010 5:32 AM
|
|
|
|
|
Try setting LP_SECURITY_ATTRIBUTES on your mailslot creation.
|
|
|
|
|
Hello Michel,
thanks for your tip.
Unfortunately we tried this. but we always got a return-code of 1307 (=ERROR_INVALID_OWNER). And we tried different security strings.
August
|
|
|
|
|
Bummer.
It may be me, but do you have a good reason for specifying FILE_SHARE_WRITE? FILE_SHARE_READ should be sufficient.
Also, could we have a look at the code that creates the mailslot? (The CreateMailSlot call)
|
|
|
|
|
Hello Michel,
the problem is solved. After your 1st message we looked at our code again and tried it again. And now it works.
Thanks for your tips. This helped us (indirectly, but it helped).
August
|
|
|
|
|
August,
I'm having the same issue on one of my projects.
Exactly how did you solve it? What code did you use for the CreateMailSlot call?
Thanks,
Brett
|
|
|
|
|
Hello Brett,
sorry for beeing late.
The problem was solved about a year ago. I do not work for this customer any more because the work is done. And I do not have access to the code any more.
What did I do? Hmmmmm
If I remember right then I 'opened up' the rights in the call, which means I allowed everyone everything on this mailslot. Please look at the description of the function call.
With this new string everything worked. And then I added carefully one restriction after the other and finally we had the restrictions as desired.
So the way was: do not experiment with possible restrictions, simnply allow everything (and for everyone). Test this. Then carefully add one restriction and test this. And so on.
Sorry, I could post the exact code that worked.
August
|
|
|
|
|
Hello Brett,
after some playing with Google I found this link:
http://msdn.microsoft.com/en-us/library/aa363858%28v=vs.85%29.aspx
If you look at my code-snippet you will find a NULL as the 4th parameter.
If I remember right then I added a value for LPSECURITY_ATTRIBUTES (the 4th parameter).
I filled the mebers of this sctructures (but I do not know the details now). The only thing I remeber is that I allowed everything (as a start).
hope this helps.
August
|
|
|
|
|
Hello Sirs,
I have compile my sample program in mingw with msys , i dont know how to create configure file and make file
in my system i have installed ms visual studio but i need to work with under mingw with msys
for Example,
#include <stdio.h>
int main()
{
printf ("Testing \n");
return 0;
}
Thanks
Failure is Success If we learn from it!!
modified on Tuesday, April 20, 2010 7:59 AM
|
|
|
|
|
Well, for such a simple test program make and configure files are overkill, just issue
gcc -o <output-file-name> <source-file-name>
at shell's prompt
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,
I am new to MFC programming.
I asked to write a Dialog based application, in which the application should monitor whether the print dialog is opened.
When the print dialog is opened and the 'Print' button is clicked, my application has to make an alert, say a message beep.
I am not able to find any help.
Please help me.
Thanks
Gokul
|
|
|
|
|
Member 3113655 wrote: ...the print dialog is opened.
By your app?
"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
|
|
|
|
|
Yes from my application.
Is there anyway the I can know that the print dialog is closed. Should know which button is clicked. As both Print and cancel button on Print Dialog can close it.
Thanks for your reply
|
|
|
|
|
If your app is opening and closing the Print dialog, then what's the problem? Until DoModal() returns, the Print dialog is open.
"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
|
|
|
|
|
I mean to catch the button click events from my application when the print dialog is poped up from another application like notepad, MS word, etc.
|
|
|
|
|
Member 3113655 wrote: ...when the print dialog is poped up from another application like notepad, MS word, etc.
Which is what I asked here.
While not a trivial task, I know it's possible to intercept window-creation messages.
"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
|
|
|
|
|
I don't know about intercepting window-creation messages. Can you please help me or provide a sample for the same.
Thanks
|
|
|
|
|
Try here.
"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
|
|
|
|
|
|
Need to format the date-time in the current format:
Thu, 15 Apr 2010 03:23:58 -0700
where you can see the date , the time and finally the zone indication .
I've no problem with the first 2 fields: I'm correcly using a combination of the functions:
GetSystemTime<br />
GetDateFormat<br />
GetTimeFormat
Now.
How can I get (from the system) and then add (to the string) the zone?
Russell
|
|
|
|
|
Found the solution: neede to use the function GetTimeZoneInformation and "restyle" the bias in the same format.
Russell
|
|
|
|
|
Use GetTimeZoneInformation,
Check the return code (this will tell you which bias to use),
display StandardBias or DayLightBias
|
|
|
|
|
Hi
How to convert imagedata to image.
#sanroop#
|
|
|
|