Microsoft
Software
Hardware
Network
Question : CreateToolhelp32Snapshot (of modules) Error 5 access denied
l'm creating MFC DLL to hook keyboard.
i'm using vc++ 6, windows 7and internet explorer 8.
Problem created to hook keyboard from internet explorer 8, in seance of windows 7
hkb=SetWindowsHookEx(WH_KE
YBOARD,(HO
OKPROC)Key
boardProc,
hins, 0);
void printError( TCHAR* msg )
{
DWORD eNum;
TCHAR sysMsg[256];
TCHAR* p;
eNum = GetLastError( );
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSE
RTS,
NULL, eNum,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
sysMsg, 256, NULL );
// Trim the end of the line and terminate it with a null
p = sysMsg;
while( ( *p > 31 ) || ( *p == 9 ) )
++p;
do { *p-- = 0; } while( ( p >= sysMsg ) &&
( ( *p == '.' ) || ( *p < 33 ) ) );
// Display the message
CString str1;
str1.Format( "\n WARNING: %s failed with error %d (%s)", msg, eNum, sysMsg );
AfxMessageBox(str1);
}
bool getModule(DWORD processID, CString* strPath)
{
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
MODULEENTRY32 me32;
hModuleSnap = CreateToolhelp32Snapshot(T
H32CS_SNAP
MODULE, processID);
if( hModuleSnap == INVALID_HANDLE_VALUE )
{
printError( "CreateToolhelp32Snapshot (of modules)" ); // Show cause of failure
return 1;
}
me32.dwSize = sizeof (MODULEENTRY32);
if(!Module32First( hModuleSnap, &me32))
{
printError( "CreateToolhelp32Snapshot (of modules)" );
printError( "Module32First" ); // Show cause of failure
CloseHandle( hModuleSnap ); // Must clean up the snapshot object!
//return 1;
}
else
*strPath = me32.szExePath;
CloseHandle (hModuleSnap);
return 0;
}
Error : CreateToolhelp32Snapshot (of modules) Error 5 access denied
unable to retrieve the module list from internet explorer 8 using CreateToolhelp32Snapshot. CreateToolhelp32Snapshot produced an "access denied" error. This is a privileges problem.
please give me solution, how to handle keyboard hook from internet explorer.
Answer : CreateToolhelp32Snapshot (of modules) Error 5 access denied
does it work with anything else? I suppose you need to run it as Administrator to get proper permissions
Random Solutions
How can I check for an install new updates for Symantec Backup Exec? I have clicked on the Help drop down menu, but don't see any options for updates
task manager high CPU usage widows server 2003
Can't access variable in code behind page
Is there a user_packages table synonymous to the user_tables table?
Easily change outgoing address. Outlook 2010 (or 2007 or 2003)
Visual Studio 2010 removal of Bite Order Mark VB -or PHP solution?
Error message when replying, sending, openning email in OWA
Why does the Listindex property of a Combobox reset to 0 in VBA?
Set site as read only to everyone
How to generate PDF open with new window ?