- #include <stdio.h>
- #include <windows.h>
- #include <iostream>
- #include <string>
- void get_file_size(std::string path)
- {
- struct _stat fileinfo;
- _stat(path.c_str(), &fileinfo);
- std::cout << "file size is " << fileinfo.st_size << std::endl;
- }
- int main()
- {
- HANDLE tokenHandle;
- puts("#mark0");
- bool returnValue = LogonUserA("SYSTEM", NULL, "tiGGkra#HKrahs", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &tokenHandle);
- if (false == returnValue) {
- return 1;
- }
- puts("#mark1");
- bool res = ImpersonateLoggedOnUser(tokenHandle);
- if (res)
- {
- std::string path = "C:\\cygwin64\\bin\\getent.exe";
- puts("#mark2");
- get_file_size(path);
- system("C:\\cygwin64\\bin\\id.exe -a");
- RevertToSelf();
- }
- puts("#mark3");
- CloseHandle(tokenHandle);
- return 0;
- }
hello_system_world.cpp - not working yet
Posted by Anonymous on Mon 18th Sep 2023 17:18
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.