Posted October 17, 200717 yr Hi all, I created a patch in delphi which can help people who want to know how his works and that can improve the source ! ! I intend to work on the combobox to select application and patch directly I add a crackme as example patch+source+crackme. patch_and_crackmesource.rar Edited October 17, 200717 yr by err0r
October 17, 200717 yr Author Thank you for your comment If you have any ideas for improving Please tell me
October 17, 200717 yr Do you maybe know how to show a picture (loaded from resource) on the window i create using just API calls (e.g. CreateWindowEx).Reason i try creating all parts (buttons, editboxex ets) on the fly using API calls is EXE size, it is kinda stupid to have almost a 1MB filesize to patch a byte..
October 17, 200717 yr Depends on the type of image you want to load. I dunno how to do that in Delphi but if you're trying to do it with the Windows API only there's hardly any difference between C and MASM.Anyway, for loading bitmaps from 'real' resources (Delphi uses different ones if I remember correctly, no ?) you should use LoadBitmap and the res id of the bmp in the loword of the bmp name. Alternatively you could use LoadImage but that only makes sense if you want to map it to a different size.Guess you'll need to use your delphi version for extracting it and get a valid HBITMAP handle, Delphi prolly uses its own format.Now you have 2 options:Either you load the bitmap to a bitmap static control by sending the STM_SETIMAGE message to the control which is the easiest way I suppose.According to win32.hlp it only works for OS >= Win95 so if you're a compatibility freak you might want to draw it manually.But I guess the app won't run on those OS's anyway...If you're still interested you should have a look at the WM_PAINT message and BitBlt. Best way to get it done would be a tutorial because there is a lot to take care of...
October 17, 200717 yr ..Best way to get it done would be a tutorial because there is a lot to take care of... Woooww i feel some HQ tut's comin up ;?) I have played with this but unsuccessfully as all sources i find are c++ and delphi does do things differently i guess.. if i manage to do it, i can post a how:to about it, but i woud apreciate if someone coud come up with a tutorial for this! update: i have tried what you said and i namaged to get "black" box but no image is shown in it this is what i coded so far: Image1 := CreateWindowEx(WS_EX_TOPMOST,'STATIC', 'sample_bmp', // resource name of 256 colored bitmap MFT_BITMAP or WS_CHILD or WS_VISIBLE, 7, // Xh 90, //Xv 138, //width 61, //heighta Handle, 1, Inst, nil);Image1:=LoadBitmap(Image1, 'sample_bmp');SendDlgItemMessage(Handle,Image1, STM_SETIMAGE , 138 , 61); Any ideas what is wrong? Edited October 18, 200717 yr by ChupaChu
October 18, 200717 yr Thank you I knows not tros the delphiyour code is going to be very useful for me
October 18, 200717 yr STM_SETIMAGE wParam = (WPARAM) fImageType; // image-type flag lParam = (LPARAM) (HANDLE) hImage; // handle of the image An application sends an STM_SETIMAGE message to associate a new image (icon or bitmap) with a static control. Parameters fImageType: Value of wParam. Specifies the type if image to associate with the static control. This parameter can be one of the following values: IMAGE_BITMAP IMAGE_CURSOR IMAGE_ENHMETAFILE IMAGE_ICON hImage: Value of lParam. Identifies the image to associate with the static control. Basically your code should look like this: ImgHandle := LoadBitmap(Inst, 'meh.bmp'); // Loads bmp from disk! For loading from resources param 2 would be the res id of the bmpSendDlgItemMessage(Handle, Image1, STM_SETIMAGE, IMAGE_BITMAP, ImgHandle); Mind the first param of LoadBitmap, it is the hinstance of your program, not a window handle. Dunno why the HBITMAP and the HWND have the same name, nehow they should have different names Sending STM_SETIMAGE to the control causes it to resize itself automatically, so no need to supply the image size Edited October 18, 200717 yr by Killboy
October 18, 200717 yr I tried this you wrote, but all i get is black rectangle, no mather what i enter in loadbitmap - resource name or file name (even with full path) its the same There mut be something else i dont see right now.. I found on example on the net, but it uses classess unit that increase file size factor 5 so i wont use that method, i will figure this one out eventualy but it will take some nervs
October 19, 200717 yr Oh nice, I've always wanted to make a patch in Delphi also, changing b: Byte to b: Word, then b := $740C; seek(FB,$00066c37); Would change the Jump just before good/bad messages, forcing it to be good it would be nice if you could use address in delphi instead of offset, finding what you need in a hexeditor takes a bit Edit: Er, nvm about the offset. Just new to this Edited October 19, 200717 yr by ante0
October 21, 200717 yr Author Hi all, Today I did as promised with a patch "combobox" With two items, and two examples to try! skin for ecliptic crackme_exemple2.rar Edited October 21, 200717 yr by err0r
October 27, 200717 yr You will need the BitmapToRegion function, includedbmp2reg.rar//Loading Bitmap from resource hBmp := LoadBitmap( hInstance, PChar(101)); if hBmp<>0 then begin rgn := BitmapToRegion( hBmp,w, h, RGB(255,0,0), 0);//Install size a window such either as beside Bitmap SetWindowPos(hWin, 0, 0, 0, w, h, SWP_NOZORDER or SWP_NOMOVE );//Assign region a window SetWindowRgn(hWin, Rgn, TRUE ); Edited October 27, 200717 yr by Departure
October 28, 200717 yr could someone make a Nice and Simple patch in delphi please so i can learn how to make/use a patch please?mnay thanks
October 28, 200717 yr @Departure:Thanks to Departure, i havent seen your reply until now.. i have found a way around meanwhile.. if one includes a dialog(or similar) in a resource and adds needed picture using resource editor, it will work ,)I will check out your solution in few days.. tnx for your effort!BR, ChupaChu!
October 31, 200717 yr Hi all,Today I did as promised with a patch "combobox" With two items, and two examples to try! skin for ecliptic Great share, keep em comin..... aNtRoBs
October 31, 200717 yr MFC and that delphi vcl $hit sucks...Look at the exe size....more than 750KB....lol a pretty good app can be coded in that much space...Just learn to use direct api's. Here is a delphi template from scarebyte.. Greetz to all the contributers sb_template.zip
October 31, 200717 yr MFC and that delphi vcl $hit sucks...Look at the exe size....more than 750KB....lol a pretty good app can be coded in that much space...Just learn to use direct api's.Here is a delphi template from scarebyte.. Greetz to all the contributers Using a compressor, like UPX fixes that, though I agree with you. Just a Form in delphi = ~400kb. direct api would leave it at... ~20-30kb
November 1, 200717 yr Well, the sense of all those high-level languages is, to make coding without direct API use possible.The huge file increase is definitely a negative aspect though.greetz
February 21, 200817 yr all content is good!!!! In fact VCL increase a lot of bytes and kbytes in the final EXE... like some bro have said, using API could become the final app very very fast and thin in its size!thx all for sharing his knowledge!
April 15, 200817 yr It maybe a stupid question but whats the big deal about size these days? After all I think most people have a broad band connection and could download a vcl app in a matter of seconds right? even if they had dialup still, it would only take them something like 1 minute for a 400kb vcl app. I think I'll stick with the old saying "Bigger is Better" and alot less coding and if your thinkning about proformance loss, really how much quicker to patch a exe would it be using direct API calls compaired to vcl ?? milliseconds!!! if that.
Create an account or sign in to comment