Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Detour 2.1 Hook problem

Featured Replies

Posted

Hi i seem to be having a problem with my LoadBitmapW hook, im using Detour 2.1

Im trying to hook SPIDER.EXE Windows XP version of the game, SPIDER.EXE resource has Numeric and String resources bitmaps for ids

example 108,106, "FELT", "CARDBACK", "CARD1" etc etc

FELT, CARDBACK will pass just fine in the LPCWSTR lpBitmapName, but when spider.exe resource has 2 images as Numbers resource bitmap id 108, 106..

the debugger tells me bad ptr 0x00006c (lpBitmapName) etc.. which is the 108 resource id for the bitmap


HBITMAP __stdcall Mine_LoadBitmapW(HINSTANCE hInstance, LPCWSTR lpBitmapName)
{
HBITMAP hBitmap = NULL; TCHAR tszModuleName[MAX_PATH] = {0};
GetModuleBaseName(GetCurrentProcess(), NULL, tszModuleName, sizeof(tszModuleName));
if(_tcsicmp(tszModuleName, _T("spider.exe"))==0)
{
wchar_t szOut[10] = {0};
wsprintf(szOut,_T("%s\n"),lpBitmapName);
OutputDebugString(szOut);
} hBitmap = Real_LoadBitmapW(hInstance, lpBitmapName);
return hBitmap;
}

Anyone have any solution to this problem? ive tried to convert lpBitmapName to a Integer (i.e int nValue = *(int*)lpBitmapName) but still no results

On MSDN it says:

lpBitmapName [in]

A pointer to a null-terminated string that contains the name of the bitmap resource to be loaded. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The MAKEINTRESOURCE macro can be used to create this value.

So it should look like this:


if(HIWORD(lpBitmapName))
{
wsprintf(szOut,_T("%s\n"),lpBitmapName);
}
else
{
wsprintf(szOut,_T("%u\n"),lpBitmapName);
}

And why do you check for the exe name? There's no use for that unless you inject some dll into every process. You should know what processes you hook into by that point :D

  • Author

On MSDN it says:

lpBitmapName [in]

A pointer to a null-terminated string that contains the name of the bitmap resource to be loaded. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The MAKEINTRESOURCE macro can be used to create this value.

So it should look like this:


if(HIWORD(lpBitmapName))
{
wsprintf(szOut,_T("%s\n"),lpBitmapName);
}
else
{
wsprintf(szOut,_T("%u\n"),lpBitmapName);
}

And why do you check for the exe name? There's no use for that unless you inject some dll into every process. You should know what processes you hook into by that point :D

Hi and thank you for your solution it helped me out, i was checking exe name i thought the Debugger would be the parent Process

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.