RE: CreateMutex fails with ERROR_UNKNOWN_REVISION
From: SpaCat (anonymous_at_discussions.microsoft.com)
Date: 04/23/04
- Next message: Rex A. Winn, Jr.: "Compiling SDK examples in VS .Net"
- Previous message: SpaCat: "RE: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- In reply to: Walter Poupore [MS]: "RE: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- Next in thread: Walter Poupore [MS]: "RE: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- Reply: Walter Poupore [MS]: "RE: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- Reply: Richard Ward: "Re: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 22 Apr 2004 15:36:02 -0700
By the way, i found out something interesting. I didn't mention it before, but since my program has to work both with Windows 9x and Windows NT based, i couldn't link directly to sddl.h - i had to LoadLibrary/GetProcAddress it.
Surprisingly enough, when i return to the original code (the way you described), i don't get this strange error. Only when i use the LoadLibrary method i'm getting it.
It looks something like this:
typedef BOOL (WINAPI *CONVERTSTRSECDESCTOSECDESC)(LPCSTR, DWORD, PSECURITY_DESCRIPTOR*, PULONG);
BOOL DelayConvertStringSecurityDescriptorToSecurityDescriptor(LPCSTR StringSecurityDescriptor,
DWORD StringSDRevision,
PSECURITY_DESCRIPTOR* SecurityDescriptor,
PULONG SecurityDescriptorSize)
{
static BOOL bInit = FALSE;
BOOL bResult = FALSE;
TCHAR tcSysPath[MAX_PATH];
if(GetSystemDirectory(tcSysPath, sizeof(tcSysPath)))
strncat(tcSysPath, "\\AdvAPI32.dll", 14);
if (!bInit)
{
hMod = LoadLibrary(tcSysPath);
bInit = TRUE;
}
if (hMod)
{
CONVERTSTRSECDESCTOSECDESC pfnConvertStringSecurityDescriptorToSecurityDescriptor = NULL;
pfnConvertStringSecurityDescriptorToSecurityDescriptor = (CONVERTSTRSECDESCTOSECDESC) GetProcAddress(hMod, "ConvertStringSecurityDescriptorToSecurityDescriptorA");
if (pfnConvertStringSecurityDescriptorToSecurityDescriptor)
{
return ((pfnConvertStringSecurityDescriptorToSecurityDescriptor)(StringSecurityDescriptor,
StringSDRevision,
SecurityDescriptor,
SecurityDescriptorSize));
}
else
{
DWORD dwError = GetLastError();
dprintf ("pfnConvert failed = error is [%d]\n", dwError);
}
}
else
{
DWORD dwError = GetLastError();
dprintf ("hMod failed = error is [%d]\n", dwError);
}
return 0;
}
And i call it like this:
if(DelayConvertStringSecurityDescriptorToSecurityDescriptor(
szSDDLString,
SDDL_REVISION_1,
&sa.lpSecurityDescriptor,
NULL))
{
dprintf("Delay returned true\n");
}
else
{
dprintf("Delay returned false\n");
}
if (hMod) // Free the AdvApi32 dll
FreeLibrary(hMod);
// Free the memory allocated for the SECURITY_DESCRIPTOR.
if (NULL != LocalFree(sa.lpSecurityDescriptor))
{
dprintf("Failed LocalFree\n");
}
Does this makes sense?
- Next message: Rex A. Winn, Jr.: "Compiling SDK examples in VS .Net"
- Previous message: SpaCat: "RE: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- In reply to: Walter Poupore [MS]: "RE: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- Next in thread: Walter Poupore [MS]: "RE: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- Reply: Walter Poupore [MS]: "RE: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- Reply: Richard Ward: "Re: CreateMutex fails with ERROR_UNKNOWN_REVISION"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|