Not sure what gave you that idea. That code will build and function correctly on both 32/64 bit platforms. The library 'Secur32.lib' was named a really long time ago and just like the path'C:\Windows\System32' the decision was made to keep the old name.
Derell Licht wrote:
I searched through *all* .h and .hpp files in c:\mingw, and these functions were not declared anywhere...
I very rarely use the MinGW compiler tools. The errors you are getting are simple #include errors. I checked the msys2 source code repository and found mingw-w64/ntsecapi.h which is dated Dec 13, 2013 has all of the required function declarations.
Sounds like you just need to update your development environment.
Ahhh!! So you *are using 64-bit compiler then ?!?!
mingw-w64 is the 64-bit compiler... and in my 64-bit compiler, they are also present, but not in the 32-bit compiler...
Actually, though, I found a way to make this work with Mingw32...
I found the clue in a page for gkrellm application, which has a support file to add support for system functions which are missing in default MinGW-32 package...
What he did is use LoadLibrary() to load and obtain a handle for secur32.dll,
then used GetProcAddress() to get pointers to the required functions:
hSecur32 = LoadLibraryW(L"secur32.dll");
if (hSecur32 != NULL)
pfLELS = (pfLsaEnumerateLogonSessions)GetProcAddress(hSecur32, "LsaEnumerateLogonSessions");
if (pfLELS == NULL)
wprintf(L"Could not get address for LsaEnumerateLogonSessions() in secur32.dll\n");
That worked beautifully for me!!
And yes, your code *does* in fact return the login times that I was looking for; Thank You again!!
Well, since this works so nicely, I thought I would include the complete, working demo function here... however, apparently, I cannot actually attach a file in a message, so I will just link to the file in my Github repository, in the program that it will be used in.
Declare a structure "Student" which contains the following information:
Grade for5 subjects
2. Write a function to
search for a Student ID and if exists write "Found", otherwise, write "Not Found"
Write the Student found (ID and Grade) to a file with file name "StudentFile.txt
In the main (0 function:
Read the data of an array of 10 students from the user (i.e., keyboard)
Read from the user a student ID to search for
Invoke the function search to search for the Student ID read by the user
Sorry, I don't understand what you try to accomplish. Are you trying to document how your library has to be used by a client program? In this case, I've seen instructions like:
"... place an include directive to <cool_library.h> in your program"
"... place an include directive to <cool_library.h> before the include directive for <not_so_cool.h>"
If you are looking for something else, try to explain more.
It is still not clear what you mean by "the process". There is no process as such, you just need to ensure that the compiler can find all declarations and/or definitions of any functions that you are trying to use. Either within your source file or in an associated header.
Last Visit: 31-Dec-99 18:00 Last Update: 28-Jul-21 18:59