|
Hi,
I am developing a dll which uses NetUserGetInfo to retreive the home directory of a Domain user.
NetUserGetInfo returns 1008 error code.
my usage of function:
NetUserGetInfo(Domain-server,domain-user,11,buf)
The problem i was thinking was, The dll is launched by a local user(admin privilages) on a system which is in the same domain. SO may be the local user does not have enough permissions to use the NetUserGetInfo function to retreive the necessary information.
My questions:
1. Is it possible to provide enough permissions for the local-user, How?
2. The other alternate is to connect to domain-server with some power user and then use the NetUserGetInfo function. But I do not find suitable function to connect to domain server with a power user credentials in windows network management API(netapi32.lib)
Thanks for the help
|
|
|
|
|
gbabu17 wrote: NetUserGetInfo returns 1008 error code.
Which is ERROR_NO_TOKEN .
What are Domain-server , domain-user , and buf ?
Do you have UNICODE and _UNICODE defined?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
they are passed to the function correctly, because i am printing them just before passing to the NetUserGetInfo.
|
|
|
|
|
gbabu17 wrote: they are passed to the function correctly...
But are they wchar_t or TCHAR types?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
They are wchar_t types.
i think it is something related to permissions(may be ACL) but i cannot figure it out.
thanks
|
|
|
|
|
In the MSDN-documentation for the InitializeCriticalSection-function it says :
In low memory situations, InitializeCriticalSection can raise a STATUS_NO_MEMORY exception.
Now, what exactly do i have to catch here ?! Couldn't find any hint anywhere.
|
|
|
|
|
Mr.Brainley wrote: Now, what exactly do i have to catch here ?!
There's nothing to catch.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ok, rephrasing the question : What should i do ? Current strategy : nothing. But what exactly happens in such a low memory situation ? Does it crash the program ?
|
|
|
|
|
Mr.Brainley wrote: What should i do ?
Based on what I read, nothing (can be done).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: nothing (can be done).
you mean besides stopping an unhandled exception from closing your app?
led mike
|
|
|
|
|
led mike wrote: you mean besides stopping an unhandled exception from closing your app?
Since the exception is not raised in an exception-safe manner, I'm not sure. Don't try and catch it is the only thing I know to do.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Just a guess...
__try
{
::InitializeCriticalSection(...);
}
__except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
...STATUS_NO_MEMORY exception
}
|
|
|
|
|
Hi there,
I have an application that exchanges messages (text message) between a mobile device and another appication software using socket connections (udp to the mobile device and TCP to the second application) and now I need in some circumstances send a short message to a mobile phone (cell phone) so that if the person can not access the mobile device, he can receive a text on his cell phone to go to look into the mobile device. I need to know how I can provide the connection from my application (windows base)to mobile phones using their phone numbers.
I appreciate any usefull idea.
Best regards,
nahitan
|
|
|
|
|
Onw way is to just send an e-mail to their_number@their_carrier. Other than that, is SMS an option?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
As far as i know, i think it can be done using GSM modem and AT commands.
KIRAN PINJARLA
|
|
|
|
|
Can anyone tell me what conditions would cause a call to gmtime() to crash the program?
|
|
|
|
|
SteveRubio wrote: Can anyone tell me what conditions would cause a call to gmtime() to crash the program?
When it's used incorrectly.
Seriously, if you can provide a code snippet, better help can be provided.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Fair enough
static char * yetanotherfunction(){
struct tm *newtime;
time_t ltime;
time(<ime);
newtime = gmtime(<ime);
return (asctime(newtime));
}
The commented line is where the crash occurs. And I've tried moving it around and it is the call to gmtime() that causes problems.
I'm modding a project that I've inherited and this block of code has never caused problems in previous iterations.
|
|
|
|
|
What are you doing with the return value from yetanotherfunction() ? What do you mean by "crash?"
SteveRubio wrote: ...this block of code has never caused problems in previous iterations.
That you know of. A problem may well have existed, but just never surfaced.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
assigning it to a char *, which then gets printed out to the console. At least, that's what's previously happened when the function worked.
And by crash I mean the program stops and windows says that the program has encountered a problem and needs to close. The exception code is 0xc0000005, which I beleive is an access violation, but how the block of code would cause it is beyond me.
As for the last part, fair enough. Change my statement to read "this block of code has never caused program crashes in previous iterations"
|
|
|
|
|
SteveRubio wrote: assigning it to a char *...
Assigning, or copying.
Do you call gmtime() , mktime() , or localtime() elsewhere in your code?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
char * s;
s = yetanotherfunction();
And gmtime is called many other places throughout the code.
I've been looking at some documentation and tinkering with various stuffs, and using _gmtime64() instead of gmtime() doesn't cause the error. The asctime() seems to be the one that fails when I do that.
|
|
|
|
|
SteveRubio wrote: ...using _gmtime64() instead of gmtime() doesn't cause the error.
I would be more inclined to do something like:
char s[32];
strcpy(s, yetanotherfunction()); Because _gmtime64() still shares a common, static structure.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
the strcpy thing will probably be enacted when these shennanigans with the time are figured out.
However, I figured out that rather than just crashing, _gmtime64() simply returns NULL.
|
|
|
|
|
SteveRubio wrote: However, I figured out that rather than just crashing, _gmtime64() simply returns NULL.
So what time value is being passed to it? I assume you've read this:
These functions validate their parameter. If timer is a null pointer, or if the timer value is negative, these functions invoke an invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, the functions return NULL and set errno to EINVAL.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|