err0r Posted October 17, 2007 Share Posted October 17, 2007 (edited) 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, 2007 by err0r 3 Link to comment
err0r Posted October 17, 2007 Author Share Posted October 17, 2007 Thank you for your comment If you have any ideas for improving Please tell me Link to comment
ChupaChu Posted October 17, 2007 Share Posted October 17, 2007 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.. Link to comment
Killboy Posted October 17, 2007 Share Posted October 17, 2007 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... Link to comment
ChupaChu Posted October 17, 2007 Share Posted October 17, 2007 (edited) ..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, 2007 by ChupaChu Link to comment
xyl/FWK Posted October 18, 2007 Share Posted October 18, 2007 Thank you I knows not tros the delphiyour code is going to be very useful for me Link to comment
Killboy Posted October 18, 2007 Share Posted October 18, 2007 (edited) 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, 2007 by Killboy Link to comment
ChupaChu Posted October 18, 2007 Share Posted October 18, 2007 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 Link to comment
ante0 Posted October 19, 2007 Share Posted October 19, 2007 (edited) 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, 2007 by ante0 Link to comment
err0r Posted October 21, 2007 Author Share Posted October 21, 2007 (edited) 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, 2007 by err0r Link to comment
Departure Posted October 27, 2007 Share Posted October 27, 2007 (edited) 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, 2007 by Departure Link to comment
cegy Posted October 28, 2007 Share Posted October 28, 2007 could someone make a Nice and Simple patch in delphi please so i can learn how to make/use a patch please?mnay thanks Link to comment
ChupaChu Posted October 28, 2007 Share Posted October 28, 2007 @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! Link to comment
antrobs Posted October 31, 2007 Share Posted October 31, 2007 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 Link to comment
yamraaj Posted October 31, 2007 Share Posted October 31, 2007 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 Link to comment
ante0 Posted October 31, 2007 Share Posted October 31, 2007 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 Link to comment
Sonny27 Posted November 1, 2007 Share Posted November 1, 2007 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 Link to comment
Guest crazy_v_k Posted November 6, 2007 Share Posted November 6, 2007 thanks for the source code m8, very helpfull Link to comment
reptilla Posted February 21, 2008 Share Posted February 21, 2008 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! Link to comment
P0uy4 53z4r Posted February 21, 2008 Share Posted February 21, 2008 Very good ! Thank you very much eRROR :biggrin: Link to comment
GioTiN Posted February 22, 2008 Share Posted February 22, 2008 Very good ! Thank you very much eRROR :biggrin:welcome Pouyabye Link to comment
Departure Posted April 15, 2008 Share Posted April 15, 2008 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. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now