I really need some help with this one. I have wasted too much time and not made much progress. What I am trying to do is to read a timestamp from index.dat generated by Internet Explorer. The timestamp is in the file in the following format "00 14 AC 72 BE 95 C2 01". A document I read takes the value and reverses the order so that the value is "0x01C295BE72AC1400" and then passes it into the w32tm function as follows: "w32tm /ntte 0x01c295BE72AC1400" and gets a return of "146792 02:41:12.0000000 11/26/2002 8:41:12 PM (local time)". I'm trying to accomplish this within my Visual C++ program but just can't get it. I'm certain there are others out there who are smarter and more experienced when it comes to such issues. I just want to be able to read the data from the file and pass it into asctime to get a meaningful date and time stamp. Does anyone know how to accomplish this? Many Thanks
rexpiper
Posts
-
Timestamp challenges -
Help with ASCII conversionI have a date time stamp which I have read from a file. I have read it as ascii characters and have stored it in a character array as follows: The data is stored in the reverse order in the file where I read it i.e. [0] [1] [2] [3] [4] [5] [6] [7] has to be reordered as [7] [6] [5] [4] [2] [1] [0]. The bytes are put into a character array as a hexadecimal representation of a timestamp. (actual example) dt = "0x01c5556a92792c8c0" Now in order to pass it to the localtime function I need to convert this ascii hex representation of my timestamp to an int64. I must be having a senior moment but I can't figure out how to do this (seemingly simple) operation. Could someone more experienced please help me with this? Thanks
-
Access Denied Reading RegistryI guess I figured it out, thanks for considering helping me.
-
Access Denied Reading RegistryPerhaps some of you who are more experienced with Windows programming could answer this question for me. I have the ability to access values in the Windows registry but when I try to access a variable which holds path information, I get an "Access Denied" error. The variable I am trying to read is HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\History. I'm using RegOpenKeyEx and RegQueryValueEx to read the value but I must be missing something here. This is the code I'm using. void ShowError() { LPVOID lpMsgBuf; if (!FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL )) { // Handle the error. return; } // Process any inserts in lpMsgBuf. // ... // Display the string. MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); // Free the buffer. LocalFree( lpMsgBuf ); } BOOL GetHistoryFolder() { HKEY hKey; char szHistory[100]; DWORD dwBufLen=100; LONG lRet; LPDWORD Type; lRet = RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", 0, KEY_QUERY_VALUE, &hKey ); if( lRet != ERROR_SUCCESS ) { ShowError(); return FALSE; } lRet = RegQueryValueEx( hKey, "History", NULL, (LPDWORD) &Type, (LPBYTE) szHistory, dwBufLen); if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) ) { ShowError(); if (Type == (LPDWORD)REG_SZ) printf("Type is REG_SZ\n"); else printf("Type is %ld\n",Type); return FALSE; } RegCloseKey( hKey ); printf("History is [%s]\n",szHistory); return(TRUE); } Please help! Rex