All,
I have an XP SP3 machine that is crashing using my software only when it is run from home, wirelessly connected but no domain controller or anything.
I get the following dump
Call stack below ---
# ChildEBP RetAddr Args to Child
WARNING: Stack unwind information not available. Following frames may be wrong.
00 0337ddc8 77e9f942 000006ba 00000001 00000000 kernel32!RaiseException+0x52
01 0337dde0 77e9fc30 000006ba 0337e1f4 0337e1d8 RPCRT4!RpcRaiseException+0x34
02 0337ddf0 77ef560b 0337de3c 0000004c 00217d40 RPCRT4!RpcRaiseException+0x322
03 0337e1d8 77de1ee8 77ddf4b0 77de14e4 0337e1f4 RPCRT4!NdrClientCall2+0x13b
04 0337e1ec 77de1e6a 00209878 0337e260 00000800 ADVAPI32!LsaOpenPolicy+0xc1
05 0337e240 77de5be7 0337e28c 0337e260 00000800 ADVAPI32!LsaOpenPolicy+0x43
06 0337e2a8 77de5b7a 015246d0 0337e930 0337e3f0 ADVAPI32!LookupAccountNameW+0x8e
07 0337e2d0 10006903 015246d0 0337e930 0337e3f0 ADVAPI32!LookupAccountNameW+0x21
The code that I suspect is
char aTmp[MAX_PATH];
DWORD dwSize=sizeof(aTmp);
SID_NAME_USE aTmp2;
unsigned short usDmn[MAX_PATH];
DWORD dwDmn=sizeof(usDmn);
wchar_t* pDomain;
if (!rDomain.empty())
pDomain=(wchar_t*)rDomain.c_str();
else
pDomain=NULL;
if (!LookupAccountNameW(pDomain, (wchar_t*)rUser.c_str(), (PSID)aTmp,
&dwSize,
(LPWSTR)usDmn,
&dwDmn,
&aTmp2))
//Error
return aInfo;
user and domain are string 开发者_StackOverflow社区vars that are passed in...
Anything obvious I am missing? What exception Is being thrown?enter code here
Everywhere you cast is probably an error. You've not shown us all the definitions but the very fact that you are casting suggests something is wrong. You appear to be passing ANSI parameters to a Unicode function.
Why are you using unsigned short instead of a wide char?
Also your SID looks all wrong.
The type of rUser
is string
and not wstring
, assuming you needed to add the (wchar_t*)
cast to the call to .c_str()
to make the compiler not complain.
Similarly, rDomain
may also be of the 8-bit string
type instead of the 16-bit wstring
type.
精彩评论