The following code works on Windows XP but fails on Vista. I need you to change it so it works on XP and Vista. You must have tested this on Vista before I will accept the work as complete. PROFILEINFO pi; ZeroMemory(&pi,sizeof(pi)); [login to view URL] = sizeof(PROFILEINFO); HANDLE hToken = NULL; BOOL fStatus = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_IMPERSONATE | TOKEN_DUPLICATE, &hToken); if(!fStatus || hToken == NULL) { MessageBox(NULL, "Failed to open security token of the current process.", "Error", MB_OK|MB_ICONSTOP); return false; } char pszUname[UNLEN + 1]; ZeroMemory(pszUname,sizeof(pszUname)); DWORD dwSize = UNLEN; fStatus = GetUserName(pszUname,&dwSize); if(!fStatus) { MessageBox(NULL, "Failed to get current user's name.", "Error", MB_OK|MB_ICONSTOP); CloseHandle(hToken); return false; } [login to view URL] = pszUname; // ***************************** // This is where it goes wrong!! // ***************************** fStatus = LoadUserProfile(hToken,&pi); // ***************************** // End // ***************************** CloseHandle(hToken); if(!fStatus) // Fails in Vista!!!!!!!! { MessageBox(NULL, "Failed to load user's profile.", "Error", MB_OK|MB_ICONSTOP); return false; } ################################# To find out more information about fStatus you could run this code: DWORD errorCode = GetLastError(); LPVOID lpMsgBuf; DWORD nbChar = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |FORMAT_MESSAGE_FROM_SYSTEM| FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorCode, 0, (LPTSTR) &lpMsgBuf, 0, NULL); OutputDebugString( (LPCTSTR)lpMsgBuf); LocalFree( lpMsgBuf );
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
Windows XP & Vista