|
Derell Licht wrote: Is this intended to be a 64-bit-only operation??
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.
Best Wishes,
-David Delaune
|
|
|
|
|
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!!
|
|
|
|
|
Derell Licht wrote: That worked beautifully for me!!
And yes, your code *does* in fact return the login times that I was looking for; Thank You again!!
You are welcome.
Best Wishes,
-David Delaune
|
|
|
|
|
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.
derbar/login_lsa.cpp at master · DerellLicht/derbar · GitHub[^]
Be sure to enable the STAND_ALONE macro to build stand-alone utility, either in the code, or by putting the macro on the command line, like this:
g++ -Wall -O2 -DSTAND_ALONE=1 login_lsa.cpp -o login_lsa.exe -lsecur32
It works very nicely!!
|
|
|
|
|
|
Actually, that's a good idea... I haven't created an article here in awhile...
I did so... here is a link to the article:
Determine Time Since Last Logon[^]
modified 8-Jun-21 10:11am.
|
|
|
|
|
thanks for sharing that.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Declare a structure "Student" which contains the following information:
1
i.
ii.
Student ID
Grade for 5 subjects
2. Write a function to
i
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:
3.
i
ii.
ii.
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
|
|
|
|
|
Well, it likes like your homework. But what is your "urgent question"?
|
|
|
|
|
|
MAHMOUD ALI Jun2021 wrote: DO YOU KNOW ANSWER ??
To WHAT question? 
|
|
|
|
|
|
See #11 here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Yes, I know the answer. So do many, many other people here.
You have to write some code to accomplish what is specified in this "assignment".
Pay special attention to the first part of that answer. "YOU have to write some code..."
Nobody is going to write this for you.
|
|
|
|
|
Drawing on another user's recent comment...
Do you think Usain Bolt got fast by having other people do his training?
|
|
|
|
|
Your question was so urgent you forgot to even ask it. 
|
|
|
|
|
I want through parameterizing a SQL query in my C++/MFC app using recordset parameterized class, but I am facing a problem with passing a UNICODE characters in parameter value
|
|
|
|
|
Zouaoui Billel wrote: but I am facing a problem Sorry, but there is no way we can guess what you mean. Please provide proper details of the problem, including the data you are using and the actual errors or messages that you see.
|
|
|
|
|
So you kept both your code and the problem description a secret.
How do you expect anyone to help you?
|
|
|
|
|
Building a ( static ) library.
If we agree that DECLARATION are in header file and DEFINITIONS are in C++ .cpp source file
what is a correct term for
#include such library header file in code so the source code using the library have what ?
"reference point" ?
(and how does it correlate with linker ?)
|
|
|
|
|
Haven’t seen any standard term. If you need such term, I’d rather go for “inclusion point”. The word “reference” has many uses and adding another one is not going to make things clearer.
Anyway it has no direct relation to the linker. It is purely a textual inclusion and it will go through preprocessor and compiler before.
Mircea
|
|
|
|
|
So a combination of Richard's
library
client
with "client's inclusion point #include "
would make some sense.
|
|
|
|
|
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"
or even:
"... 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.
Mircea
|
|
|
|
|
I was trying to find if there is a specific term for the process , not just "place include..."
Something similar to
declare function
define function
relation.
I guess there is none.
However years ago there was a book of C code standards - something "ANSI C ..." maybe it is in there.
I used to have a copy.
|
|
|
|
|
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.
|
|
|
|