ConvertStringSidToSid ERROR!!! HELP???

closed account (3hMz8vqX)
Hi All,

I recently found out the ConvertStringSidToSid()
function
and I used it in an app . . .

and I included sddl.h
accctrl.h
aclapi.h
windows.h

and all possible headers . . .

and also defined _WIN32_WINNT 0x0500

I am using Dev C++ TDM-GCC and it has sddl.h
it is the latest version of Dev C++

I also linked Advapi library . . .

when I compile this I get the following error:

[error] 'ConvertStringSidToSidA' not declared in scope!

Please help me!!!
I dont know where I went wrong!!!

Thankyou everyone in advance!!!



This function requires windows XP, so _WIN32_WINNT must be 0x0501 or higher. 0x0500 means windows 2000, which does not support this function.
Windows 2000 does support ConvertStringSidToSid (see PS.)

Converting SIDs Between Strings and Binary
Posted by Brian Friesen on December 17th, 2001
http://www.codeguru.com/cpp/w-p/system/security/article.php/c5659/Converting-SIDs-Between-Strings-and-Binary.htm

...

Starting in Windows 2000 Microsoft added two APIs for converting SIDs. They are ConvertStringSidToSid() and ConvertSidToStringSid(). The down-side to these APIs is they require the Platform SDK (for the file SDDL.H) and they don't work on Windows NT. If you are content with these restrictions, then I encourage you to use the Microsoft APIs. ...

The SDDL.h in Windows SDK 7.1 has

1
2
3
4
5
6
7
8
#if(_WIN32_WINNT >= 0x0500)

BOOL
WINAPI
ConvertSidToStringSidA(
    __in  PSID     Sid,
    __deref_out LPSTR  *StringSid
    );


and the header in MinGW 4.7.2 is using

#if (WINVER >= 0x0500)

So maybe you need to #define WINVER, too?

(Unless you need to support old systems, using a higher value for WINVER/_WIN32_WINNT might make sense. See list here:

Using the Windows Headers
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx )

Andy

PS I think that MSDN's "Minimum supported client" no longer necessarily means the version the API turned up it, as it once did (or at least I used to think it did?) For example, the minimum supported client for CreateFile is Windows XP, where time now apparently starts (since Windows 2000 is no longer supported). Of course, CreateFile turned up at the dawn of time, in Windows NT 3.1.

But it appears that the entries aren't all in step. The entry for CloseHandle still refers to Windows 2000 Professional (I'm pretty sure CloseHandle predates that!)
Last edited on
closed account (3hMz8vqX)
Thankyou very much andywestken!

Because of you I have done it YAY! :)

now I have defined WINVER as 0x0500
and it worked!

Please answer all my other questions which
I will be posting on this forum!

Good Luck! :)

---Aravind
Topic archived. No new replies allowed.