Iczelion's Win32 Assembly Forum [http://pluto.beseen.com/boardroom/h/19390] Edited by TomCat/Abaddon (26 Apr 1999) [mailto://tomcat@szif.hu] =============================================== Subject: Starting discussion about Win32 Assembly Date: 30 Jul 1998 08:59:26 From: Arnon Thaicharoen Hi, everybody This forum is for those who're interested in assembly programming for Win32 platform. If you have any comments, info to share, or questions to ask, post them here. I love assembly language and want to see it florish under Win32. Assembly programming on Win32 platform is really easier than the old DOS platform. We have Win32 API calls which constitutes the standard library. Work is in progress to develop the Visual Assembler which is a visual development tool for assembly language programmers. Best Regards, Arnon Thaicharoen =============================================== Subject: need help Date: 5 Aug 1998 06:19:06 From: Fox Mulder Dear Arnon Thaicharoen, it's me, Fox. Now I need a banner to link your Forum on my page about Assambly language programming for Win32. May you make this one for me? Thanks! And good luck! Fox Mulder. =============================================== Subject: Visual Assembler project Date: 30 Jul 1998 12:18:54 From: Arnon Thaicharoen There's a new assembly project on the web. A group of assembly language programmer is building a visual development tool for assembly language in the same vein as other "Visual" programming language. The assumption is that assembly language is alive and well in Win32 environment but it's just neclected by the majority of programmers. Writing Win32 program in assembly is NOT really harder than other programming languages. You get smaller and faster programs. All is happy. period. Besides, writing Win32 programs in assembly makes you get close to the heart of Win32 system. You get to know it intimately. I admit that assembly language is notorious for steep learning curve. But nothing good in this world is for free. You must fight to get it! This Visual Assembler project is in alpha. But a beta will be due in this summer. It'll always be free for all to use. So please at least take a look at its homepage: http://www.fortunecity.com/skyscraper/lycos/403/ Regards, Arnon Thaicharoen =============================================== Subject: How do you handle graphics? Date: 2 Aug 1998 13:25:56 From: Arnon Thaicharoen :In Dos assembly programming, programmers often wrote directly to :video memory at A000:0000h, or B800:0000h. How can you bypass the :windows API functions and write to video memory the same way? I'm afraid programs cannot do that sort of thing in Windows. Ring-3 codes cannot directly access hardware device. Only ring-0 codes such as virtual device drivers can do that. :And can you give me code to find the resoloution/number of colors :on the system? sure! the code is below. I use console mode in order to simplify the source code. I use TASM 5.0 to assemble this program. It's really small, only 4096 bytes!. ;=============================================================== ; Below is the batch file used to assemble the program. Assuming ; you install TASM in directory TASM50 ;=============================================================== c:\tasm50\bin\tasm32 /mx /m3 /z /q color c:\tasm50\bin\tlink32 -x /Tpe /ap /c color,,,c:\tasm50\lib\import32.lib ;=========================================================== ; color.asm: This program shows how to get information about ; display capability of PC under Win32. ; Written by: Arnon Thaicharoen ;================================================================ .386P .Model Flat ,StdCall mb_ok equ 0 ;mb_ok gets the value "0" hWnd equ 0 ; 0 means no window is the owner of ; the message box. ; declaration of all used API-functions extrn ExitProcess : PROC ;procedure to shut down a process extrn MessageBoxA : PROC ;procedure to show a MessageBox extrn GetDC : PROC ;procedure to get device context extrn ReleaseDC : PROC ;procedure to release device context extrn GetDeviceCaps : PROC ;procedure to get the information about ;device context extrn _wsprintfA : PROC ;procedure to convert value to ;other format, such as string extrn GetDesktopWindow: PROC ;procedure to get the window ;handle of the desktop .Data text db "The resolution is %lu bits/pixel",0Dh,0Ah db "The width of the screen is: %lu pixels",0Dh,0Ah db "The height of the screen is: %lu pixels",0 caption db "Determining Screen Color and resolution",0 ;Captionstring, 0-terminated .Data? ; uninitialized data hdc dd ? ; handle to device context of desktop bitsperpixel dd ? ; number of bits per pixel of desktop scrwidth dd ? ; width of the desktop in pixels scrheight dd ? ; height of the desktop in pixels buffer db 200 dup(?) ; text to write on client area of message box hwnd1 dd ? ; window handle of desktop ; and here we start with our code .Code Main: call GetDesktopWindow ; First get window handle of desktop mov hwnd1,eax ; store window handle for use in ReleaseDC push eax ; parameter of GetDC call GetDC ; Get device context of desktop mov hdc,eax ; store device context push 12 ; value indicating that we request ;number of bits per pixel push eax call GetDeviceCaps ; Get number of bits/pixel mov bitsperpixel,eax push 8 ; request width of desktop push hdc call GetDeviceCaps ; Get width of desktop mov scrwidth,eax push 10 ; request height of desktop push hdc call GetDeviceCaps ; Get height of desktop mov scrheight,eax ;=========================================================== ; Now we convert all three numbers into string for showing in message box ; wsprintfA is an exception to STDCALL convention because it receives variable ; number of arguments. So we must push parameters from right to left and ; clean up the stack ourselves. ;=========================================================== push scrheight push scrwidth push bitsperpixel push OFFSET text push OFFSET buffer call _wsprintfA add esp,20 ;==================================================================== ; Now that we got the result, release the device context and show ; the message box. ;==================================================================== push hdc push hwnd1 call ReleaseDC push mb_ok ;PUSH value for uType push OFFSET Caption ;PUSH Pointer to Caption push OFFSET buffer ;PUSH Pointer to Text push hWnd ;PUSH Masterhandle call MessageBoxA ;CALL MessageBoxA CALL ExitProcess ;End (exit) program End Main ;End of code, Main is the entrypoint =============================================== Subject: Bug fix Date: 4 Aug 1998 18:14:32 From: Arnon Thaicharoen ExitProcess takes one parameter, the return code. The correct usage should be push eax ; assume return code is in eax call ExitProcess =============================================== Subject: How do you handle graphics? Date: 16 Aug 1998 07:11:16 From: mammon_ What?!? A Win32 assembly forum and no-one told me? ;) Ok, Barry kauler demonstrated how to write directly to video RAM in windows in his Windows Assembly Language Book. It's a little ugly, but it works... You can overwrite the windows screen if you obtain a selector to the video ram for the VM, which he says corresponds to the physical video ram (I haven't tested it). You can return to windows with repaintscreen()[from Undoc Win95] or int 31h, func 4002 (ax=4002)--though he supplies no source for this. The source he does supply is for DPMI direct-screen writes: ;DPMI.ASM ;This demo program is written in TASM v3.0. ;It uses the WINASMOO.INC OO-file developed in Chapter 7. ;This program makes use of DPMI & low-level Windows functions. ;This program relates to discussion in Chapter 9. ;remember that Windows funcs only preserve SI,DI,BP & DS. INCLUDE WINDOWS.INC INCLUDE WINASMOO.INC IDM_QUIT EQU 100 IDM_ABOUT EQU 101 .DATA window1 WINDOW { szclassname="DPMI",sztitlename="DPMI DEMO",\ paint=w1paint,create=w1create,command=w1command,\ createstylehi=WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN, \ char=w1char, sziconname="icon_1",y_coord=10,timer=w1timer,\ destroy=w1destroy } control1 CONTROL { szclassname="BUTTON",sztitlename="OK",\ x_coord=20,y_coord=40,wwidth=30,wheight=20, \ hmenu=IDOK,createstylehi=WS_CHILD+WS_VISIBLE,\ createstylelo=BS_PUSHBUTTON } .CODE kickstart: lea si,window1 ;addr of window object. call [si].make PASCAL,si ;make the window. lea si,control1 call [si].make PASCAL,si ;make child window ret ;............................ w1paint PROC PASCAL LOCAL hdc:WORD LOCAL paintstructa:PAINTSTRUCT lea di,paintstructa call BEGINPAINT PASCAL,[si].hwnd, ss,di mov hdc,ax call SELECTOBJECT PASCAL,ax, [si].hfont call TEXTOUT PASCAL,hdc,10,20, cs,OFFSET outstring,33 call ENDPAINT PASCAL,[si].hwnd, ss,di ret outstring DB "Click button for direct video o/p " w1paint ENDP ;............................................. w1create: call GETSTOCKOBJECT PASCAL,OEM_FIXED_FONT ;Windowsfunc. mov [si].hfont,ax ret ;............................................. w1command: cmp WORD PTR [si].lparam,0 ;lo half=0 if a menu selection. jne notmenu ret notmenu: cmp [si].wparam,IDOK ;button child window selected? ;note that lo-word of lparam has handle of control window, ;hi-word of lparam has notification code. jne notbutton lea si,control1 ;since si points to window1. call DESTROYWINDOW PASCAL,[si].hwnd ;kill the button mov [si].hwnd,0 ;must clear hwnd, if want to make() later. ;what we will do now is make the new window always stay visible.... lea si,window1 call SETTIMER PASCAL,[si].hwnd,1,200, 0,0 ;200mSec timeout. ;post WM_TIMER to window every 200mS. 1=timer id. notbutton: ret szmsg DB "Created by Barry Kauler, 1992",0 szhdg DB "Message Box",0 ;................................................... w1char: ;let's bring back the button if any key pressed... lea si,control1 ;since si points to window1. call [si].make PASCAL,si ret ;...................... w1destroy: call KILLTIMER PASCAL,[si].hwnd,1 ;created by SETTIMER(). call POSTQUITMESSAGE PASCAL,0 ret ;........................ w1timer: ;comes this way if a WM_TIMER message.... ;this WinApp keeps on posting a WM_TIMER message to itself, thus this ;section is in a continuous loop... call dpmidemo ret ;............................................................ dpmidemo: ;comes here if button selected. now we will do some direct video... mov ah,0Fh ;get current video state int 10h ;--> al=mode,ah=width,bh=page mov mode,al ;save mov columns,ah ; / mov vpage,bh ; / mov ah,3 ;get current cursor position mov bh,vpage ;video page int 10h ;-->dh=row,dl=col,cx=cur.size mov curpos,dx ;save. ;all of this below, writes the pseudo text mode window onto the scrn... mov ah,2 ;set cursor position mov dh,5 ;row=5 mov dl,columns shr dl,1 ;centre cursor on screen mov bh,vpage ;video page push dx ;save int 10h mov dx,OFFSET szdirect mov ah,9 ;write a string to scrn int 21h pop dx ;restore inc dh ;next row mov bh,vpage mov ah,2 push dx ;save int 10h ;set cursor mov ah,9 ;write string mov dx,OFFSET szdir2 int 21h pop dx ;restore inc dh ;next row on scrn mov bh,vpage mov ah,2 int 10h ;set cursor mov ah,9 ;write string mov dx,OFFSET szdir3 int 21h mov ah,2 ;restore cursor pos. mov dx,curpos mov bh,vpage int 10h ret .DATA mode DB 0 columns DB 0 vpage DB 0 curpos DW 0 szdirect DB "ÚÄÄÄÄÄÄÄÄÄÄÄÄ¿$" szdir2 DB "³BIOS/DOS O/P³$" szdir3 DB "ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ$" ;........................................................... END =============================================== Subject: Good Win95 assembly tutorial on the web Date: 4 Aug 1998 03:49:48 From: Arnon Thaicharoen I have stumbled upon a good site about Win95 assembly. It has many chapters of tutorial about how to program Win95 in assembly. It's the only site I know that contains tutorials. Visit it and download everything inside. The url is http://www.eskimo.com/~htak/win95asm/win95asm.htm Enjoy. =============================================== Subject: My own Win32 asm tut page is up Date: 24 Aug 1998 04:03:57 From: Iczelion My humble Win32 asm tutorial page is up. The url is http://iczelion.home.ml.org/iczelion. Please take a look. Any suggestion or comment is welcome. =============================================== Subject: My own Win32 asm tut page is up Date: 25 Aug 1998 16:52:07 From: Fox Mulder Hello, dear Iczelion! I like your tutorials very much. They are very professional. Now I am working on the russian translations. But one thing is strange: in the tutorial No 3. you wrote about CommandShow variable, but it is missing in your listing. Why? Good luck! Fox Mulder. =============================================== Subject: Thanks for notifying me. Date: 26 Aug 1998 19:09:43 From: Iczelion It's an error of my own. The first draft of the source code listings contains the variable CommandShow. But later, I decided not to use it. Thanks. =============================================== Subject: WinAsm channel on IRC Date: 16 Aug 1998 10:33:54 From: Arnon Thaicharoen There's a channel named #winasm in EFNET which is set up specifically for talking about programming Windows using assembly language. Admitted,I've not met anybody there yet, but it seems a good place to check out. =============================================== Subject: WinAsm channel on IRC Date: 17 Aug 1998 03:10:29 From: Iczelion :#WinAsm is dead for quite a time, only one bot there. :Though, there's #Win32Asm which is alive and kickin' :) Thanks. It's truly alive! Nice to meet all the folks there. I'll talk with you again, and again and again..... :) =============================================== Subject: DirectDraw Through Assembler Date: 20 Aug 1998 01:31:48 From: DarkFyre Does anybody kow how I can implement DirectDraw through assembler? Most/all of the code supplied with the SDK is in C, and it's messy and annoying to compile these and try and get TLINK to accept Visual C++'s .OBJ files in the final project. Any pointers? DarkFyre =============================================== Subject: DirectDraw Through Assembler Date: 20 Aug 1998 08:05:30 From: Iczelion Never program DirectDraw with assembler. But if you have the SDK and the code in C, you can write equivalent code in asm. Check out Henry's page at http://www.eskimo.com/~htak/win95asm/win95asm.htm for win95 asm programming tutorial and download win32asm toolkit from http://www.fortunecity.com/skyscraper/lycos/403/ Good luck, Iczelion =============================================== Subject: Calling conventions in win32asm Date: 22 Aug 1998 19:03:16 From: Net Walker! Hi all, I would like to suggest you, Win32 Assembly coders, use function prototypes in order to make easier to write code in assembly. If you have Tasm 5.0 you can avoid the boring way of pushing parameters to stack in reverse order...then call the function name (after making an EXTRN declaration at the beggining of the source file). What I mean is, instead of using: EXTRN MessageBoxA : PROC . . . push 0 push offset MyTitle push offset MyMessage push hWnd call MessageBoxA you can create a prototype for MessageBox: PROCDESC WINAPI MessageBoxA :DWORD, :DWORD, :DWORD, :DWORD then, when you need to use MessageBox, you just type: call MessageBoxA, hWnd, offset MyMessage, offset MyTitle, 0 Its very similar to C coding, isnt it? Obviously, a productive way for using such an approach would be creating a .inc file with all Win32 API function prototypes. There is already a include file done by Barry Kauler and modified (a little) by me. It doesnt have yet all the function prototypes, but I'll be working on it from now on - in order to use it in Visual Assembler. If you use MASM, you can have such file already done - look for Walk32 example. Another thing I'd like to suggest you regards using resource scripts in order to create the whole GUI (even the main windows). You can found an example about such things (prototypes and resource script) in my tiny debugger Nwdebugger 0.3 - you can found it on Lord Caligo, Stone, Sudden Discharce and some other sites. I'm just returning from a long trip and after installing Mirc (i lost my HD 2 months ago) I will look for you guys at #win32asm. Have a nice day... ..now its time to have a look at Visual Assembler ptoject :) =============================================== Subject: Function prototype in MASM Date: 22 Aug 1998 23:21:56 From: Iczelion In MASM, you implement function prototype like this: MessageBoxA PROTO STDCALL,:DWORD,DWORD,:DWORD,DWORD then, when you need to use MessageBox, you just type: call MessageBoxA, hWnd, ADDR MyMessage, ADDR MyTitle,MB_OK :call MessageBoxA, hWnd, offset MyMessage, offset MyTitle, 0 =============================================== Subject: Function prototype in MASM Date: 22 Aug 1998 23:54:29 From: Iczelion In MASM, funcion prototype is defined like this: MessageBoxA PROTO STDCALL, :DWORD,:DWORD,:DWORD,:DWORD then, when you need to use MessageBox, you just type: invoke MessageBoxA, hWnd, addr MyMessage, addr MyTitle, MB_OK You can use offset instead of addr. :Another thing I'd like to suggest you regards using resource :scripts in order to create the whole GUI (even the main windows). : You can found an example about such things (prototypes and :resource script) in my tiny debugger Nwdebugger 0.3 - you can :found it on Lord Caligo, Stone, Sudden Discharce and some other :sites. I've examine it. A good work of using resource script. :) :I'm just returning from a long trip and after installing Mirc (i :lost my HD 2 months ago) I will look for you guys at #win32asm. We at #win32asm are looking forward to you. =============================================== Subject: MessageBox fonts and size Date: 30 Aug 1998 20:18:19 From: TomServo :Is it possible to control the font and the size of the MessageBox :function? If no, is there other API's which is able to do so? :Thx. The font and size, etc of a messagebox is determined by the system defaults. IE, they are the same as used on all window title bars, etc. I believe it is kept in the registry, but i'd have to dig up exactly where and I am not at my "developer" machine this weekend. Keep in mind changing them for your dialog box changes them for everything re-painted in any app until you change it back. If you really desire such customality, perhaps it is best to use a dialog box. =============================================== Subject: MASM or TASM? Date: 30 Aug 1998 20:23:01 From: TomServo I'm just beginning program development in ASM for the '86 platform. My intent is to be able to turn out a few VxD's and the occasional light tight Windows app. My main question before I get too deep into this is which should be my tool of choice, MASM or TASM? Is one better then the other (ie, I have read TASM can be co-erced to do OOP easily), or is this mostly a matter of taste? My only comment is I have all the MS .inc and .h I would need, getting the Borland equivalents would be another project. Thanks. (And hello to you all on the forum) =============================================== Subject: MASM or TASM? Date: 31 Aug 1998 06:17:36 From: Iczelion Well, I don't want to start a debate about TASM VS MASM. If you read Barry Kauler's book, "Windows Assembly Language and Systems programming", you can look at the preamble of the chapter "ring-3 code". In summary, Kauler suggests that you use MASM. TASM 5.0 follows the steps of MASM so you can convert MASM source code into TASM equivalent with reasonable ease. However, he also points out one problem: Passing parameter to a function in TASM may be problematic if that parameter is a local variable since TASM uses OFFSET directive to assign the address at assemble time and the address of local variable is not known until runtime. MASM use ADDR which is fine under the circumstance. If you want to program VxDs, I think you should consider MASM. =============================================== Subject: MASM or TASM? Date: 11 Sep 1998 14:31:45 From: david11372 I, too, have read Barry Kauler's book and although he makes an attempt to discuss the use of both MASM and TASM, I think you will find any sample assembly programs on the Internet all use MASM. According to Mr. Kauler, Borland tried to play catchup with TASM 5.0, yet there are some subtle differences that will drive you up the wall. I started out with Borland TASM in engineering school and have stayed with their products. It was perfect for a digital control system design I did, however, now that I am trying to recode the pgm for Windows 95 use, I wish I had MASM. Life would be much simpler. Dave =============================================== Subject: Assembling VxD's and coff option trouble Date: 31 Aug 1998 03:40:06 From: TomServo I'm new to this particular stuff. I'm attempting to just assemble some sample VxD's, but I always generate similar error messages to this. set ML=-coff -DBLD_COFF -DIS_32 -nologo -W3 -Zd -c -Cx -DMASM6 -DINITLOG -DDEBLEVEL=1 -DDEBUG -Fl ml -Fovxdbody.obj vxdbody.asm Assembling: vxdbody.asm vmm.inc(495): error A2210: 16 bit segments not allowed with /coff option vmm.inc(499): error A2210: 16 bit segments not allowed with /coff option NMAKE : fatal error U1077: 'C:\DevStudio\VC\BIN\ml.exe' : return code '0x1' Stop. Error executing NMAKE. I believe the coff option is a file format needed for the link.exe to use, but apparently it isn't good for mixing 16 and 32 bit code. Any suggestions or hints? Thanks in advance. =============================================== Subject: Assembling VxD's and coff option tro Date: 31 Aug 1998 06:02:02 From: Iczelion COFF is the file format that Win32 borrows from Unix. I believe that VxD uses LX file format. /coff is not necessary for link. TASM generates OMF files exclusively. OMF is the old Intel file format that 's used before Windows 95 came about. I think MASM can generate OMF files as well but haven't try yet. =============================================== Subject: Assembling VxD's and coff option tro Date: 2 Sep 1998 01:04:38 From: TomServo Thanks, dropping the coff attributes from the .mak file and it compiles and links just fine. (Well, does make half a hundred warnings, but nothing too serious looking). I think the file will even work (comparing the dis-asm with the origional) =============================================== Subject: Assembling VxD's and coff option tro Date: 11 Sep 1998 04:03:18 From: TomServo A final item: If I use ml.exe from the win98ddk (free at microsoft.com), the coff options work just fine. I've read this version of ml was custom taylored for VxD's. =============================================== Subject: Process Information Date: 11 Sep 1998 19:47:05 From: Andoni Hello! Anyone know how I can know what are the process that are running, I've heard that I have to use Process32First & Process32Next. =============================================== Subject: Julian date conversion Date: 11 Sep 1998 14:37:08 From: david11372 Can anyone give me advice on what WIN32API function call to use that will put the current date in the tm structure. I have also noted that is a tructure called SYSTEMTIME, however, the tm structure has an additional parameter called tm_dyear which I need for setting up the Julian date. Any help would be greatly appreciated. Dave =============================================== Subject: Julian date conversion Date: 12 Sep 1998 05:37:35 From: TomServo I strongly suggest you go to Microsoft's MSDN site and sign up, there is much info worth finding there. I got this from the MSDN CD that came with MSVC. Well worth the $60-70 the academic verison of version 5 pro cost me, you can even use the Developer Studio environment for asm work. The GetLocalTime function retrieves the current local date and time. VOID GetLocalTime( LPSYSTEMTIME lpSystemTime // address of system time structure ); Parameters lpSystemTime Points to a SYSTEMTIME structure to receive the current local date and time. Return Values This function does not return a value. (This is in C syntax, of course) =============================================== Subject: Writing to console Date: 13 Sep 1998 22:57:36 From: Ghiribizzo Is it possible to write to the console of the dos prompt. i.e. C:\>myasmprog Text out in this console here. Program ends. C:\> i.e. how does one get the handle to the current console? =============================================== Subject: Writing to console Date: 14 Sep 1998 07:17:45 From: mammon_ :hmm. this forum doesn't seem to cope well with arranging text. To :clarify: is it possible to write to the same console the app is :run from (i.e. not create a new console). I have found that writing to the stdout works fine. Are you trying to mix console apps with a GUI, i.e. GUI apps that are launched from the console and respond back to it? That seems kind of weird.... =============================================== Subject: Writing to console Date: 15 Sep 1998 07:11:27 From: mammon_ :If I'm reading you right, you wish to run a program in a dos box :and have your text appear there? If so, all the DOS INT 21H :functions are still there for use. That's what would have been my 'Hello, World' app ;) Good ole int 21h func 09h You can always play with the video modesusing int 10h as well, but on reflection it seems that you may be trying to use the Win32 API functions along with dos interrupts. As long as you keep the windows.inc you should be Ok, no need to get the DOS console handle, though if you want to be true to the MS way you should use DPMI. Of course, you may be trying to use this: WriteConsole( hConsoleOutput, *lpvBuffer, cchToWrite, lpcchWritten, lpvReserved); which admittedly I have never tried in assembly language. I assume that GetStdHandle( STD_OUTPUT_HANDLE ); would work even in asm, but if I can assume you've tried that then I would recommend sticking to the Int21h functions...I found that as long as I do not use a wndclass-based program they work OK. _m =============================================== Subject: Writing to console Date: 15 Sep 1998 19:41:10 From: Ghiribizzo I'm using the GetStdHandle and WriteConsole functions. They're not working, but I think they should as I've seen similar code elsewhere. I'll check my code. Also, my first program was basically a push 0, call exitprocess. However, it crashes. But when I put in the GetModuleHandle function (usual 3 lines, push 0, call, store in whatever) it works. Is this normal? I'm using TASM at the moment. =============================================== Subject: Writing to console Date: 22 Sep 1998 08:38:41 From: razzi :Can you email me a simple Hello world program? I'm having trouble :getting the console handle via getstdhandle. Hi ghiri, There are API's that you can use to write to and read from the console. But i see you already figured that out :--) The reason that "they dont work" is perhaps you didnt link your program to be a console app. I think tlink32 makes GUI apps by default. (Actually the only difference between a GUI app and a console app is the value of one flag in the PE header) If you want sources, i think stone has some on his page. I got some too, let me know if you are interested. hope this helps, razzi@usa.net =============================================== Subject: windows.inc Date: 14 Sep 1998 07:21:21 From: mammon_ :Is there a full windows.inc file zipped up somewhere on the net? :I've got a few bits and bobs? If not, would somebody mind :concatenating the .h files and u/l them somewhere on the net? There is one inside the disk for Kauler's book (my site and others) for TASM; there is one inside Walk32 (my site and others) for MASM, and there is one inside Gij's Nasm-Win32 toolkit for Nasm (greythorne's site). If you need any of these I can email them to you. For the record, none of them is *thorough*, although I think Gij made the best attempt to be thorough--the others were more of a "what-is-most-commonly-used" functions list. _m =============================================== Subject: windows.inc Date: 14 Sep 1998 09:12:47 From: g I'm working on one for NASM, will be releasing a win32_lean_and_mean (ha! is that a joke or what?) version when I've finished them. So far I've done: windows.h imm.h mcx.h ole2.h winbase.h (now in lots of little files) wincon.h windef.h winnetwk.h winreg.h winresrc.h winsvc.h wintypes.h Have yet to do: winnls.h wingdi.h winuser.h winnt.h winerror.h lots of includes for ole2 All the externs will have macros to go with them so they can be called just like a HLL without having to worry about writing a load of pushes every time (what a pain). Doing these by hand takes a while.....but it'll be worth it for nice small apps. I intend to also release some non-trivial demos to go with it (ie not just a hello world app). Probably a CD-player app (simple, yet demonstrates many Win32 principles). I will eventually go the whole hog and try for DirectX as well...then we have proper speed, DirectX w/asm. Eat my dirt! l8r, g =============================================== Subject: windows.inc Date: 15 Sep 1998 06:59:39 From: mammon_ :Thanks, I have all of those. I was just wondering if anyone had :already made a "complete" one. How about the ones from the DDK, if you are using Masm? =============================================== Subject: win32 include files for TASM Date: 23 Sep 1998 21:23:50 From: Linuxjr :::I've got one at my site: :::http://www.chocbar.demon.co.uk/ghiribizzo/win32t.zip :: ::I, too, receive the same Error 404 message and I tried and.... : :Hmm. Oh well. I've uploaded the 2nd version of the file now. Has :anyone been able to fetch either file? Nope still gets Error 404 message and did it a couple of times. Same message for both files win32t.zip and win32t2.zip. =============================================== Subject: win32 include files for TASM Date: 24 Sep 1998 03:52:53 From: Linuxjr :I've found out why. For some reason, the files have been created :with a capital W. i.e. Win32t2.zip or whatever. : :In fact my whole site's a mess as the capitalisation has gone bad :(upper case etc.) I'll fix in a few days. You can download now by :using the correct filename. Sorry about that. That fixed it. Just have to captilize the w in win32t.zip and win32t2.zip and they download. =============================================== Subject: sdk library 2 asm include file converter Date: 23 Sep 1998 13:36:47 From: hutch I have just finished this toy and it seems to be reliable within certain limitations which are documented in the text file. I have posted it on my homepage at address, http://www.pbq.com.au/home/hutch/download/l2i.zip It produces MASM prototypes by default but has a text search & replace which will convert PROTO to PROCDESC for TASM in MASM mode. Hope it is useful there folks. =============================================== Subject: console mode version Date: 28 Sep 1998 09:40:33 From: hutch I have posted the file l2inc.exe on my home page for converting platformsdk lib files to ASM include files. The console mode version uses produces either MASM or TASM syntax from command line options and will run in batch mode. Testing so far indicates that this version completely eliminates duplicate prototypes and the include files work in MASM with no editing. http://www.pbq.com.au/home/hutch/download/l2inc.exe I will email this version to Iczelion for posting on his site as this may be more convenient in terms of bandwidth. I now have a working "windows.inc" file that has all the equates and structures but it may still be a bit rough around the edges. It works in MASM with the include files generated by the l2inc.exe program so if anyone needs it, email me and I will post it on my home page. hutch =============================================== Subject: LZEXPAND.DLL Date: 15 Sep 1998 23:33:48 From: Ghiribizzo The API ref mentions that there is a compressor called compress.exe which will compress to the format that lzexpand can understand. Anyone have an url for this? =============================================== Subject: LZEXPAND.DLL Date: 16 Sep 1998 05:20:52 From: TomServo I have the compress.exe file, it came with the VB set-up kit. The uncompressor must be around there too, unless it's burried in the setup1.exe program they also supply. setup1.exe is not a dos program and doesn't respond to /? or /help command switches. Possibly you already have it in the "make a distributable" file of some MSproduct you have. F:\VB\setupkit\kitfil32>compress /? Microsoft (R) File Compression Utility Version 2.00 Copyright (C) Microsoft Corp. 1990-1992. All rights reserved. Compresses one or more files. COMPRESS [-r] Source Destination COMPRESS -r Source [Destination] -r Automatically rename compressed files. Source Source file specification. Source may be multiple file specifications. Wildcards may be used. Destination Destination file / path specification. Destination may be a directory. If Source is multiple files and -r is not specified, Destination must be a directory. Wildcards may not be used. =============================================== Subject: LZEXPAND.DLL Date: 16 Sep 1998 11:36:51 From: Ghiribizzo Could you email the compress.exe to me at ghiribizzo@geocities.com? Thanks =============================================== Subject: Compress.exe for Ghiri Date: 8 Oct 1998 00:46:45 From: Iczelion Ghiri: Use FTPSearch to search for "compress.exe", you 'll find it. =============================================== Subject: Bkgnd colors option Date: 16 Sep 1998 22:49:16 From: David11372 ::If anyone has 'Programming Windows 95' by Charles Petzold, could ::you please translate the C code on pp. 554-556 to ASM for ::scrollbar coloring the background. I like what it does and at one ::time I had it working in ASM except the coloring was extremely ::unpredictable. In the constant changing of the code to attempt to ::get the proper color display, nothing now works except the actual ::display of the dialog box (from .RC file). Your help would ::certainly be appreciated and I can be emailed at ::david11372@aol.com. Many thanx. :I do have the book. But I must ask you first which assembler you :use. TASM or MASM? I am using TASM 5.0. I have studied and rewrote the code so many times and still can't figure out what is wrong. Even the scroll bars keep jumping back to the top and the numbers at the bottom of the dialog box stay at 0. Thanx for your help. Dave =============================================== Subject: Strange problem with threads Date: 17 Sep 1998 19:21:24 From: Ghiribizzo I wrote a program which plays a sound using the MessageBeep function. I then wrote another program which would load the first program suspended, then patch the program to make it play a different sound, then resumed the thread. The program was basically this: call CreateProcessA call WriteProcessMemory call ResumeThread However, if I resume thread before writing to the process, the program is still patched!? call CreateProcessA call ResumeThread call WriteProcessMemory Any explanations? Files are available at http://ghiribizzo.home.ml.org Look for file mpat.zip (not linked) In fact the URL is http://www.chocbar.demon.co.uk/ghiribizzo/mpat.zip =============================================== Subject: tasm/masm directives Date: 20 Sep 1998 02:46:00 From: Iczelion :Does anyone have a list of Tasm/Masm directives with :explanations? for MASM 6.1 manuals go to _rudeboy's page: http://members.xoom.com/_rudeboy For tasm, email me. =============================================== Subject: tasm/masm directives Date: 20 Sep 1998 09:33:16 From: mammon_ Have the tasm manuals and a scanner. The Quick ref has about 40 pages which equals about 20 scans. If Iczelion has nothing prepared, let me know--you know the address. _m =============================================== Subject: Play Midi files in Win32 asm Date: 20 Sep 1998 08:29:11 From: Iczelion :Can anyone pls show me how to load and play a midi file in Win32 :asm using Tasm 5.0 any help appreciated. an example would be :nice. tks, Dan. Well, the easiest way to play any multimedia file is to use the MCI function, mciSendStringA. I include the source code below: .386 .model flat,stdcall extrn mciSendStringA:PROC extrn ExitProcess:PROC .data midi_command db "play c:\windows\media\canyon.mid",0 .code start: push 0 push 0 push 0 push OFFSET midi_command call mciSendStringA push 0 call ExitProcess end start Note that in the midi_command, you can change it to "play ding.wav" or "play movie.avi" or even the cd-rom if you want. It's very easy, as you can see. =============================================== Subject: How to stop midi Date: 21 Sep 1998 00:23:45 From: Iczelion :THANK YOU!! IT WORKS PERFECTLY!! NOW MY FIRST DEMO HAS NICE MUSIC. :BUT WHEN I KILL THE WINDOW THE MUSIC KEEPS PLAYING. HOW DO I KILL :THE MUSIC?? :midi_command2 db "stop ",0 I TRYED THIS BUT DOESNT WORK. :TKS, DAN. No, the command is incorrect. The correct one is "close seq" to close the midi sequencer. You should consult your Win32 API reference to get more details about mciSendStringA. =============================================== Subject: dll entrypoint Date: 21 Sep 1998 00:27:26 From: Iczelion :The command line switch to specify a dll entry point with masm is -entry: :Does anyone know how to specify the entry point for a dll using TASM? There's none. TASM uses the label following "end" directive as the entry point just like a normal executable. If you want to see a dll example written by TASM, go to _HaK_'s homepage at http://perso.infonie.fr/kinher/ =============================================== Subject: dll entrypoint Date: 21 Sep 1998 01:10:01 From: Ghiribizzo Aha! You beat me to it. I came online to post the following message: I figured this out in the end. There is no special switch. Tasm just does it automatically. However, it didn't work in my program as I wrote "end" instead of "end start". =============================================== Subject: Build Problems Date: 21 Sep 1998 04:59:25 From: TomServo I'm an asm newbie, still trying to get comfortable reviewing and compiling some samples. However, I have had quite a few problems with similar Link errors. Case in point: Iczelion's tutorial #3. When I attempt to build it I score the following error: LINK : error LNK2001: unresolved external symbol _start9¿b Obviously the program start cannot be found, but why? I am using Macro Assembler Version 6.11 and Incremental Linker Version 5.12.8078. I'm sure the code itself is fine. I changed the makefile paths to my own, did I miss something? Any help is appreciated. =============================================== Subject: Build Problems Date: 21 Sep 1998 06:07:44 From: Iczelion :Case in point: Iczelion's tutorial #3. Well, since the problem case is my own creation, I feel its my responsibility to answer :) : When I attempt to build :it I score the following error: : :LINK : error LNK2001: unresolved external symbol _start9¿b : :Obviously the program start cannot be found, but why? In older versions of MASM, you have to specify the program entry point with a linker switch, /ENTRY: So, in your case, you may have to link with these switches: Link /SUBSYSTEM:WINDOWS /ENTRY:start /LIBPATH:c:\masm\lib win.obj :I am using Macro Assembler Version 6.11 and Incremental Linker :Version 5.12.8078. I'm sure the code itself is fine. I changed :the makefile paths to my own, did I miss something? You should patch MASM to v 6.13. Download ml613.exe from my page and patch your own copy of MASM. This may solve the problem. =============================================== Subject: Large File Buffers Date: 23 Sep 1998 00:34:22 From: Iczelion :In DOS programs, when reading in large files, I allocated a :certain amount of memory and read the file in chunk by chunk. Is :this the way to do things in win32? I suspect not. You can use the same approach under Win32 but it's not recommended. Under Win32, you should use memory-mapped files instead. When you use a memory-mapped file, you can safely assume that the whole file is in memory. You can read from and write to any location in the file using a pointer much like you do with a memory region. You don't have to worry about allocating a memory block. In fact, the PE loader uses this method to load PE executables into memory. =============================================== Subject: Large File Buffers Date: 25 Sep 1998 00:22:25 From: Ghiribizzo Thanks for the info. If I can trouble you further... :) Have you got the numerical equivalents for the following: PAGE_READWRITE FILE_MAP_ALL_ACCESS FILE_MAP_WRITE Thanks. =============================================== Subject: Large File Buffers Date: 25 Sep 1998 01:56:16 From: Iczelion PAGE_READWRITE equ 4 FILE_MAP_ALL_ACCESS equ 0F001Fh FILE_MAP_WRITE equ 2 =============================================== Subject: walk processes/modref under winNT Date: 23 Sep 1998 17:49:48 From: RudeBoy :Does any1 know how to walk modref list and processes under winNT.. You need to use functions in psapi.dll, which comes with the platform sdk. you make a call to EnumProcesses, then get a process handle with OpenProcess, you can then use EnumProcessModules to get the process modules. It get's a little trickier when dealing with 16 bit processes and ntvdm.dll. You can get more information on this at: http://support.microsoft.com/support/kb/articles/q175/0/30.asp (It also has information on the toolhelp32 api's for win9x) Good Luck, I hope that helps, RudeBoy =============================================== Subject: walk processes/modref under winNT Date: 25 Sep 1998 01:35:25 From: jubee i've read this article and realized that the "documented" method is actually the same that i was already familiar under win95.. but i'm still wondering if there is a more powerfull way to walk processes/modref under nt (like Pietrek's win32lwalk for win95 enviroment). :Good Luck, I hope that helps, :RudeBoy yep, and tnx for your kindness . Jubee =============================================== Subject: drawing Date: 25 Sep 1998 13:19:42 From: Ghiribizzo I've been playing around with a few things connected with the DC api functions. I've been trying to vary the pen color but it seems to be either black or white. I think I've locked the bitmap into black and white mode, but I'm not sure. Also, if you try moving the window about, the background fuzz changes. Any idea where this fuzz comes from? Files are available from: http://www.chocbar.demon.co.uk/ghiribizzo/sp.zip =============================================== Subject: drawing Date: 25 Sep 1998 16:25:00 From: TomServo I took a look at your code cause I'd like to play with more API painting myself, I've read a few resources on the subject but never gotten around to writing my "learning" code myself. Unfortunately, we speak different assemblers, you TASM, me MASM, and I cannot cross that bridge yet. But I get the idea of your code. It looks to me likw you use CreateCompatibleBitmap to create your working area and BitBlt to get it out to the world. This is fine. The "noise" you see is uninitionalized memory, the actual leftover RAM data where the bitmap was created. This is easiest to fix: Before you draw your Micky Mouse elipses draw a rectangle with a black brush to fill the bitmap black. Now you have colors, which brings us to paletts, where I cannot lead you. Good luck. =============================================== Subject: drawing Date: 25 Sep 1998 23:13:59 From: Ghiribizzo I must be going mad. I forgot that I put the drawing routines into the message loop! BTW, I really ought to have put it in WM_PAINT rather than WM_MOVE, but I get lazy when in the testing phase. =============================================== Subject: drawing Date: 25 Sep 1998 20:44:04 From: Ghiribizzo :The "noise" you see is :uninitionalized memory, the actual leftover RAM data where the :bitmap was created. This is easiest to fix: Before you draw your :Micky Mouse elipses draw a rectangle with a black brush to fill :the bitmap black. Hmm. I thought about uninitialised ram. The thing that confused me is: shouldn't the noise be the same when you move the window about? =============================================== Subject: drawing Date: 26 Sep 1998 11:14:12 From: TomServo No, really, the noise is uninitialized ram. Try running your app a few times in sucession. When I did this, I could see the Micky Mouse from the previous run scroll thru my new window as I draged it around the screen. When you CreateCompatableBitmap, the bitmap itself chosen is a default 1x1 black and white bitmap. That's hardly enough area to cover your window, hence uninitialized area. =============================================== Subject: String transfer to dialog box Date: 26 Sep 1998 02:34:05 From: mammon_ :Is there a way to place a string created in your ASM file into a :dialog box prior to its display, yet not use the rectangular :EDITEXT box to dsplay it? If so, what changes need to be made in :the .RC file and which WIN32API function needs to be used? Thanx You have to use the Static Text control. In Borland this is CONTROL "YourText", -1, "BorStatic" in Symantec it is LTEXT "YourText", IDC_STATIC by default...so it is probably resource-compiler specific. =============================================== Subject: String transfer to dialog box Date: 28 Sep 1998 09:39:59 From: hutch If you want to set the text of an edit control in a dialog box from you program code, trap the WM_INITDIALOG msg in the dialog message proc and use SendMessage to send a WM_SETTEXT message to the edit control. =============================================== Subject: equates Date: 26 Sep 1998 11:22:31 From: TomServo :Hello. Could somebody tell me the equate for LR_LOADFROMFILE :can't seem to find it in any of the inc files i have. tks, Dan. I found it in winuser.h from the freebie Win98 DDK (a good thing to get) #define LR_LOADFROMFILE 0x0010 =============================================== Subject: bitmap fun Date: 26 Sep 1998 15:01:00 From: Ghiribizzo Here's part of the 'packaging' for a game trainer I'm writing. I've used a similar method as in my last post to load a bitmap. I have a few questions to ask the win32asm gurus: 1. What is the best way to keep the bitmap 'updated' e.g. after window move/resizes etc. 2. Is it obvious where the program may be leaking GDI resources? I ran the program about 40 times and saw my GDI resources dropping. I'll probably run bounds checker on it later as I think that detects such things. File can be found at: http://www.chocbar.demon.co.uk/ghiribizzo/mc.zip =============================================== Subject: bitmap fun Date: 27 Sep 1998 21:37:34 From: TomServo :2. Is it obvious where the program may be leaking GDI resources? Oh yeah, in your orgional post you leaked resources a plenty. ;-) ; the following is psudo-asm code to track API GDI calls: ; see sp.asm wmmove: newhwnd = 0 call GetDC (newhwnd) ; this is the DC for the ; entire screen (since ; newhwnd = 0) mov WinDC,eax call CreateCompatibleDC(WinDC); a private area to work mov MemDC,eax call CreateCompatibleBitmap(MemDC) mov hBitmap,eax call SelectObject(hBitmap) mov hOldBitmap,eax call CreatePen mov hPen, eax call SelectObject(hPen) mov hOldBrush,eax call Ellipse ; do some drawing with the pen call Ellipse call Ellipse call BitBlt ; paint the drawing on the screen ; this clean-up was omitted in orgional code ; we have to delete the GDI resources we created SelectObject (hOldPen) ; restore the orgional pen to the ; DC (it is a bad thing to delete ; a selected resource) DeleteObject (hPen) ; delete our new pen SelectObject (hOldBitmap) ; restore the orgional bitmap ; to the DC DeleteObject (hBitmap) ; delete our new bitmap DeleteDC (MemDC) ; delete the DC we created ReleaseDC (WinDC) ; releace the DC we borrowed ret You might want to keep the orgional DC and bitmap you created around and just BLT it over again for re-paints from window moves or such. =============================================== Subject: bitmap fun Date: 28 Sep 1998 09:58:35 From: hutch The bitmap stays updated if it is drawn from WM_PAINT message. That is the normal place to draw a "persistent" bitmap from. You will get memory leaks if you do not use the APIs SelectObject and DeleteObject correctly. I will have a look around and see if I can find it in C or similar. I have got it floating around in everything except ASM. You usually use BitBlt() for placing the bitmap or StretchBlt() to change its size ands place it. hutch =============================================== Subject: bitmap fun Date: 28 Sep 1998 10:28:48 From: hutch Ghiribizzo, I found some ASM that shows how to use SelectObject() and DeleteObject(. Its written in MASM high level syntax but it converts back to stack pushed and call syntax if you want it that way. The two system colours passed to the framing proc are values found in the GetSysColor() API. ;######################################################################## Paint_Proc proc hWin:DWORD, hDC:DWORD LOCAL btn_hi :DWORD LOCAL btn_lo :DWORD invoke GetSysColor,20 mov btn_hi, eax invoke GetSysColor,21 mov btn_lo, eax invoke FrameWin,hWin, hDC, btn_hi, btn_lo, 2 invoke FrameWin,hWin, hDC, btn_lo, btn_hi, 4 invoke FrameWin,hWin, hDC, btn_hi, btn_lo, 7 return 0 Paint_Proc endp ;######################################################################## FrameWin proc hWin:DWORD,hDC:DWORD, btn_hi:DWORD,btn_lo:DWORD,step:DWORD LOCAL Rct :RECT LOCAL rv :DWORD LOCAL var :DWORD LOCAL hPen :DWORD LOCAL hPen2 :DWORD LOCAL hpenOld :DWORD invoke GetClientRect,hWin,ADDR Rct m2m var, step mov eax, var sub Rct.right, eax mov eax, var sub Rct.bottom, eax invoke CreatePen,0,1,btn_hi mov hPen, eax invoke SelectObject,hDC,hPen mov hpenOld, eax invoke MoveToEx,hDC,var,var,NULL invoke LineTo,hDC,Rct.right,var invoke MoveToEx,hDC,var,var,NULL invoke LineTo,hDC,var,Rct.bottom invoke CreatePen,0,1,btn_lo mov hPen2, eax invoke SelectObject,hDC,hPen2 mov hPen, eax invoke DeleteObject,hPen invoke MoveToEx,hDC,var,Rct.bottom,NULL invoke LineTo,hDC,Rct.right,Rct.bottom invoke MoveToEx,hDC,Rct.right,var,NULL inc Rct.bottom invoke LineTo,hDC,Rct.right,Rct.bottom invoke SelectObject,hDC,hpenOld invoke DeleteObject,hPen2 return 0 FrameWin endp ;######################################################################### =============================================== Subject: Updown controls Date: 26 Sep 1998 20:08:27 From: Ghiribizzo Has anyone used UpDown controls before? I've managed to implement one tied to an edit box but there seems to be a problem. In the API prototype, it states the min/max values are INTS which would be 32 bits in a win32 system, I assume. However, in the UDM_GETRANGE structure, it states that it is only 16 bits. To confuse matters, having experimented a little, the min/max values don't seem to have any sense to them at all!! It isn't too bad. The control doesn't specify the dword for the current position (which I need to do for my particular application) so I will probably write my own custom control for it. However, I've let you have this to have a play around with. Another thing I was playing around with in this was making the whole window 'draggable' you'll see what I mean. However, any ideas on how to grey out the close button (top right X)? Zip available at: http://www.chocbar.demon.co.uk/ghiribizzo/mc2.zip =============================================== Subject: How to make the window draggable Date: 27 Sep 1998 01:05:10 From: Iczelion :Another thing I was playing around with in this was making the :whole window 'draggable' you'll see what I mean. That's very easy. You just have to process WM_NCHITTEST message and return the value HTCAPTION like this: cmp ax,WM_NCHITTEST je MakeItCaption ..... MakeItCaption: mov eax,HTCAPTION ret That's all. We tell Windows that everywhere on our window is the title bar. :However, any :ideas on how to grey out the close button (top right X)? Use EnableWindow function. =============================================== Subject: Borland Resource file Date: 27 Sep 1998 15:42:25 From: Magic Tip Hi , i'm searching for help on resource script langage. BRW miss it. Thanks , Magic Tip. =============================================== Subject: Borland Resource file Date: 27 Sep 1998 18:04:33 From: Ghiribizzo I've uploaded rsl.zip to my site. Check other messages for appropriate url. =============================================== Subject: Asm syntax highlighting Date: 28 Sep 1998 21:56:37 From: Ghiribizzo I've started a text coloring project for UltraEdit32. If you want to download what I have so far or want to help. Please download the following file: http://www.chocbar.demon.co.uk/ghiribizzo/color1.zip =============================================== Subject: Asm syntax highlighting Date: 28 Sep 1998 23:44:14 From: mammon_ Greythorne has such a file already on his site...check the assembly page. I haven't tested it as I don't use Ultra Edit At any rate it may give you a good base to build off so that you don't duplicate effort (or reinvent the wheel, or some pat cliche) _m =============================================== Subject: Missing Operator Date: 28 Sep 1998 20:56:33 From: Ewayne Wagner I'm trying to teach myself windows assembler, I have written a fairly simple windows program in MASM 6.13 and I'm trying to include a combobox in the toolbar. When I assemble the program I get the following message error *.asm (595)A2206 missing operator in expression. ; Create the ComboBox push 0 ;lpParam push [hInst] ;hInstance push IDM_COMBO ;menu push [hwndtool] ;parent hwnd push 250 ;height push 100 ;width push 0 ;y push 200 ;x push WS_CHILD + WS_BORDER + WS_VISIBLE + CBS_HASSTRINGS + CBS_DROPDOWN ;style ***LINE 595*** push offset szNULL ;Title string push offset combo ;Class name push 0 ;extra style call CreateWindowEx mov [comhwnd],eax push SW_SHOWNORMAL push [comhwnd] call ShowWindow push [comhwnd] call UpdateWindow If I remove the CBS_HASSTRINGS + CBS_DROPDOWN from the style it assembles OK, but of course no combobox. Any clues? THANKS =============================================== Subject: Missing Operator Date: 28 Sep 1998 22:34:52 From: hutch Ewayne, Why are you using "+" with the windows styles instead of "or" where the "or" is normal. CBS_HASSTRINGS equ 200h CBS_DROPDOWN equ 2h These are the equates for the two additional styles, have a go at orring them. The following PROC works OK, ;######################################################################## ListBox proc a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,hParent:DWORD,ID:DWORD szText lstBox,"LISTBOX" invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR lstBox,0, WS_VSCROLL or WS_VISIBLE or \ WS_BORDER or WS_CHILD or \ LBS_HASSTRINGS or LBS_NOINTEGRALHEIGHT or \ LBS_DISABLENOSCROLL, a,b,wd,ht,hParent,ID,hInstance,NULL ret ListBox endp ;######################################################################### Regards, hutch =============================================== Subject: Missing Operator Date: 28 Sep 1998 23:48:08 From: ma It may be that he is using line seperators, i.e. :: push WS_CHILD + WS_BORDER + WS_VISIBLE + ::CBS_HASSTRINGS + CBS_DROPDOWN ;style ***LINE 595*** should be push WS_CHILD + WS_BORDER + WS_VISIBLE + \ CBS_HASSTRINGS + CBS_DROPDOWN The +'s work just as good as the "||"'s, actually... _m =============================================== Subject: Missing Operator Date: 29 Sep 1998 00:31:27 From: Ewayne I made the above change and still get the error. I even replaced the '+' sign with 'or' and then with '|', still does not work. =============================================== Subject: Missing Operator Date: 29 Sep 1998 01:11:15 From: Ewayne I replaced my combobox with your listbox example and made LBS_ equates in my *.INC file, when I assemble I still receive the same error. What I'm I doing wrong? THANKS =============================================== Subject: Missing Operator Date: 29 Sep 1998 04:19:56 From: hutch Ewayne, Use this litle macro, you must put the predefined window class in the CreateWindowEx() call or the function will fail. If you have the string in you [.data] section it will do the same thing, ; push offset combo ;Class name szText MACRO Name, Text:VARARG LOCAL lbl jmp lbl Name db Text,0 lbl: ENDM This one assembles Ok so check your other equates in a C header or similar. Try both examples in the client area first and if they work, the problem relates to the toolbar handle. Good Luck =============================================== Subject: Missing Operator Date: 29 Sep 1998 05:00:49 From: hutch I just put you code into a test proc and it assembled fine. It sounds like you have a problem with the parent handle. My test prog has the hInstance & hWnd in the [.data] section so they are accessible all over the app. TestProc proc szText combo,"COMBOBOX" push 0 ;lpParam push hInstance ;hInstance push 0 ;menu push hWnd ;parent hwnd push 250 ;height push 100 ;width push 0 ;y push 200 ;x push WS_CHILD or WS_BORDER or WS_VISIBLE or \ CBS_HASSTRINGS or CBS_DROPDOWN ;style ***LINE 595*** push 0 ;Title string push offset combo ;Class name push WS_EX_CLIENTEDGE ;extra style call CreateWindowEx ret TestProc endp Try a yukky like this to test the parent handle. ; ------------------------------ cmp eax, 0 jne nxt1 szText TstMsg1,"eax = 0" invoke MessageBox,0,ADDR TstMsg1,ADDR dbTxt,MB_OK jmp nxt2 nxt1: szText TstMsg2,"eax != 0" invoke MessageBox,0,ADDR TstMsg1,ADDR dbTxt,MB_OK nxt2: ; ------------------------------ hutch =============================================== Subject: Missing Operator Date: 29 Sep 1998 05:17:52 From: Ewayne Hutch: Thanks for all of your help, I'm getting a little tired and I don't know what I done, but the program assembles OK and I have a combobox. I will try to find out what I done after I get some sleep. Now I will have to figure out how to load it and do something with it. Thanks again. Ewayne =============================================== Subject: NASM version for UltraEdit Date: 29 Sep 1998 08:38:29 From: g :Thanks. I'll check it out and see what can be combined. Here's the one I use. It's probably not got everything, but I left out things I didn't think were too important at the time. (They just cluttered up my display).
/L5"NASM x86 assembler" Nocase Line Comment = ; File Extensions = ASM INC MAC
/C1
aaa aad aam aas adc add and arpl
bound bsf bsr bswap bt btc btr bts
call cbw cdq clc cld cli clts cmc cmov cmp cmpsb cmpsw cmpsd
cmpxchg cmpxchg486 cmpxchg8b cpuid cwd cwde
daa das dec div
emms enter
f2xm1 fabs fadd faddp fbld fbstp fchs fclex fnclex fcmovb fcmovbe
fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu
fcom fcomp fcompp fcomi fcomip fcos fdecstp fdisi fndisi feni
fneni fdiv fdivp fdivr fdivrp ffree fiadd ficom ficomp
fidiv fidivr fild fist fistp fimul fincstp finit fninit fisub fld
fld1 fld2e fldl2t fldlg2 fldln2 fldpi fldz fldcw fldenv
fmul fmulp fnop fpatan fptan fprem fprem1 frndint fsave frstor
fscale fsetpm fsin fsincos fsqrt fst fstp fstcw fstenv
fstsw fsub fsubp fsubr fsubrp ftst fucom fucomp fucompp fucomi
fucomip fxam fxch fxtract fyl2x fyl2xp1
hlt
ibts idiv imul in inc insb insw insd int int3 int1 icebp int01
into invd invlpg iret iretw iretd
jcxz jecxz jmp ja jae jb jbe jc je jg jge jl jle jna jnae jnb jnbe
jnc jne jng jnge jnl jnle jno jnp jns jnz jo jp jpe jpo js jz
lahf lar lds les lfs lgs lss lea leave ldgt lidt lldt lmsw loadall
loadall286 lodsb lodsw lodsd loop loope loopz loopz loopne loopnz
lsl ltr
mov movd movq movsb movsw movsd movsx movzx mul
neg not nop
or out outsb outsw outsd
packssdw packsswb packuswb paddb paddw paddd paddsb paddsw paddusb
paddusw paddsiw pand pandn paveb
pcmpeqb pcmpeqw pcmpeqd pcmpgtb pcmpgtw pcmpgtd pdistib pmachriw
pmaddwd pmagw pmulhrw pmulhriw pmulhw pmullw
pmvzb pmvnzb pmvlzb pmvgezb pop popa popaw popad popf popfw popfd
por psllw pslld psllq psraw psrad psrlw psrld psrlq
psubb psubw psubd psubsb psubsw psubusb psubusw psubsiw punpckhbw
punpckhwd punpckhdq punpcklbw punpcklwd punpckldq
push pusha pushaw pushad pushf pushfw pushfd pxor
rcl rcr rdmsr rdpmc rdtsc ret retf retn rol ror rsm rep repe repz
repne repnz
sahf sal sar salc sbb scasb scasw scasd setae setb setbe setc sete
setg setge setl setle setna setnae setnb setnc setne
setng setnge setnl setnle setno setnp setns setnz seto setp setpe
setpo sets setz
sgdt sidt sldt shl shr shld shrd smi smsw stc std sti stosb stosw
stosd str sub
test
umov
verr verw
wait wbinvd wrmsr
xadd xbts xchg xlatb xor
/C2
%% %assign %define %elif %elifctx %elifdef %elifid %elifidn
%elifidni %elifnctx %elifndef %elifnum %elifstr
%else %endif %endmacro %endrep %error %exitrep
%if %ifctx %ifdef %ifid %ifidi %ifidn %ifidni %ifnctx %ifndef
%ifnid %ifnidi %ifnidn %ifnidni %ifnum %ifstr %include
%macro %pop %push %rep %repl %rotate %0
.bss .code .data .nolist .text
..start
_Wdosxstart
__FILE__ __LINE____NASM_MAJOR__ __NASM_MINOR__ __SECT__
absolute align alignb alloc at
bits bss byte
class code common
data db dd dw dword dq dt
endstruc extern export exec equ
flat
global group
iend import incbin info istruc
near
o16 o32 org overlay
parm private progbits public
qword
resb resd resident resw resq rest
section seg segment stack struc
text times tword
uppercase use16 use32
word write wrt
$ $$
+
-
*
|
^
&
<<
>>
/ //
/C3
ah al ax
bh bl bp bx
ch cl cr0 cr1 cr2 cr3 cr4 cs cx
dh di dl dr0 dr1 dr2 dr3 dr6 dr7 ds dx
eax ebp ebx ecx edi edx eip es esi esp
fs
gs
ip
si sp st0 st1 st2 st3 st4 st5 st6 st7
mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7
tr3 tr4 tr5 tr6 tr7
/Delimiters =   !@*()-+=\{}:;"'[] ,?
=============================================== Subject: Direct X Date: 29 Sep 1998 23:28:08 From: Mike Bibby :Does anyone have or know where to get example source for using :direct draw in asm? Yes, I use DirectX a fair bit. I'm in the process of tidying some demos up for presentation and will be putting them on a friend's web site. Mail me and I'll let you know when they're up. Mike =============================================== Subject: Direct X Date: 14 Oct 1998 22:21:24 From: Mike Bibby I've got a couple of the demos ready and I think I've emailed them to everyone who contacted me. If I've missed you, sorry. They'll be on a site soon. In the meantime email me and I'll send you them. They're TASM and MASM. The one I'm sending out is just a toy but it will get you up and running, showing how to create DirectDraw objects, how to call their methods, and how to perform a primitive animation... Cheers, Mike =============================================== Subject: Compiler for motorola 6800?? Date: 30 Sep 1998 04:36:00 From: John Craig Hello, I've signed up for an assembly course here at the university of minnesota. I know nothing about assembly at this point, but am eager to get started. The instructor requires the class to use assembler for motorola 6800. I'm not even sure what a motorola 6800 is, but I'm guessing that a desktop PC doesn't qualify. So, does anyone know of a way that I can write and test programs in Windows95 and then compile them for motoroloa 6800? --john craig crai0046@tc.umn.edu ps Please forward a copy of any replies to me via e-mail. thanks. =============================================== Subject: Compiler for motorola 6800?? Date: 30 Sep 1998 10:07:53 From: mammon_ Motorola processors are used in a number of machiens, but mostly Macs and Amigas. I came across a ton of motorola stuff on this Amiga page: http://home.sol.no/~tj1040/assem/ you should be able to find some emulators there =============================================== Subject: Compiler for motorola 6800?? Date: 14 Oct 1998 00:59:36 From: ren_ he, it seems that this particular assembly class is a bit outdated ,whereas the 68xx family(not to be mixed with the 680x0 family, mammon_, which is used in the Mac,Amiga,ST,QL,etc hardware :)isn't that bad for starting assembly. superior to the MOS65xx processors (although i only started realising that when thinking about a fast emulation of an 6809 myself)it's a good solid ground on which you can easily build up some base knowledge, which than can be ported to newer processors. But one last question, why are the guys teaching such a thing ??? Even in my very opinion it's only interesting because of retrospective reasons. No one (except nerds, arcade lovers (such as i am), and weird peoples) is interested in such a microprocessor, nowadays. He better should force his profs to teach him some MIPS, ARM, alpha or whatsoever assembly language (and i really don't recommend the x86 family as a primer !!!!) Just my 2 cents :). Regards, ren_ =============================================== Subject: Loading a combobox Date: 30 Sep 1998 12:42:39 From: Ewayne I'm using MASM 6.13 and I'm writing a windows application and I need to build an array and load it into my combobox. I have my combobox built. I have an example from a C program, but I'm having a hard time trying to convert it. Years ago I was a wiz bang 370 assembler programer on the mainframes, but what a difference with the PC. Any help would be appreciated. Ewayne =============================================== Subject: Loading a combobox Date: 30 Sep 1998 13:46:37 From: hutch Ewayne, You will have to get that big pig M$ help file win32.hlp as it has all of the messages in it. If you look up the index with CB_ you will get a heap of messages to do various things with combo boxes. You can use the, CB_ADDSTRING message to add zero terminated strings to a combo box which you send with the SendMessage() function. Hope it works OK for you. hutch =============================================== Subject: Loading a combobox Date: 30 Sep 1998 15:54:58 From: Mike Bibby I've got a very simple, standalone example program that uses a combo box to let you choose between two dummy routines to run. Part of a series of exemplar programs for Windows 95, its written for TASM5, but should be really easy to adapt. I wasn't going to release it this early, but mail me if you want a "beta copy". Mike =============================================== Subject: Combobox Selection Field Date: 2 Oct 1998 00:58:21 From: Ewayne First I want to thank all who has helped me with my program. I want to save the selected item in the selection field of my combobox to a string, example an executable program to call later. I'm using CB_GETITEMDATA and I think the address of the selected item is returned in lParam, but I guess I don't know how to extract it. I can get the index of the selected item using the eax reg with CB_GETCURSEL and I could write a routine to build a string with the index, but there must be a better way. THANKS AGAIN Ewayne =============================================== Subject: Combobox Selection Field Date: 2 Oct 1998 09:46:19 From: hutch Ewayne, you need to subclass the combo box to process the messages like mouse clicks etc.. This is done by writing a message style proc something like a WndProc message handler. What I have pasted in below is the message handling proc for the listbox code that I posted before. ListBoxProc proc hCtl :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD LOCAL IndexItem :DWORD LOCAL Buffer[32] :BYTE .if uMsg == WM_LBUTTONDBLCLK jmp DoIt .elseif uMsg == WM_CHAR .if wParam == 13 jmp DoIt .endif .endif jmp EndDo DoIt: invoke SendMessage,hCtl,LB_GETCURSEL,0,0 mov IndexItem, eax invoke SendMessage,hCtl,LB_GETTEXT,IndexItem,ADDR Buffer szText CurSel,"You selected" invoke MessageBox,hWnd,ADDR Buffer,ADDR CurSel,MB_OK EndDo: invoke CallWindowProc,lpLstBox1,hCtl,uMsg,wParam,lParam ret ListBoxProc endp The following code is the proc call for the listbox, the SendMessage call stuffs it full of file names and importantly, the SetWindowLong() call sets up the address of the message handling proc for the combo box. Make sure you put the handles hList1 for the list box & lpLstBox1 for the proc address in either your .data or .data? sections. Once you have this subclass up and going, you can pick list items out, add them in and do whatever you like. Just note that the list box and combo box messages & styles are different and you have to use the right ones. invoke ListBox,20,90,150,200,hWnd,600 mov hList1, eax szText Patn,"*.*" invoke SendMessage,hList1,LB_DIR,DDL_ARCHIVE,ADDR Patn invoke SetWindowLong,hList1,GWL_WNDPROC,ListBoxProc mov lpLstBox1, eax hutch =============================================== Subject: Combobox Selection Field Date: 2 Oct 1998 14:30:45 From: Ewayne Hutch, Everything in your example above is clear except 'invoke ListBox', should it be 'invoke ListBoxProc'? If not where is it pointing to? When should it be run, right after I create the listbox? Thanks Ewayne =============================================== Subject: Combobox Selection Field Date: 2 Oct 1998 16:26:54 From: Mike Bibby Ewayne, I'm not sure what that invoke ListBox is... Possibly it's a wrapper for a call to CreateWindow(Ex). Here's a simple demo that creates the sort of ListBox implied by the invoke. It's easy to adapt for MASM ###################################################### ; listbox Mike Bibby 2.10.98 ;This is written for TASM 5 ; for MASM : ; PROCDESC becomes PROTO ; CALL becomes INVOKE .586 .MODEL FLAT, STDCALL ;==================== equates ======================================== NULL = 0 ; null pointer MB_OK = 00000000h SW_SHOWNORMAL = 01h WS_CHILD = 4000000h WS_CHILDWINDOW = WS_CHILD WS_VISIBLE = 10000000h WS_BORDER = 00800000h WS_VSCROLL = 00200000h LBS_NOTIFY = 0001H LBS_SORT = 0002H LBS_STANDARD = LBS_NOTIFY OR LBS_SORT OR WS_VSCROLL OR WS_BORDER ;================= prototypes ======================================== GetModuleHandleA PROCDESC STDCALL :DWORD CreateWindowExA PROCDESC STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,\ :DWORD,:DWORD,:DWORD,:DWORD,:DWORD ;-------------------------------------------------------------------------------------- ; ; The real prototype for CreateWindowExA should be: ; CreateWindowExA PROCDESC STDCALL :DWORD,:LPCSTR, :LPCSTR, :DWORD, :SDWORD,\ ; :SDWORD,:SDWORD, :SDWORD, :HWND, :HMENU, :HINSTANCE, :DWORD ; ;-------------------------------------------------------------------------------------- MessageBoxA PROCDESC STDCALL :DWORD,:DWORD, :DWORD, :DWORD ExitProcess PROCDESC STDCALL :DWORD .DATA szMBText DB "You've got a list box",0 szMBCaption DB "ListBox Demo",0 szListBox DB "ListBox",0 szListBoxCaption DB "Your ListBox",0 hInstance DWORD NULL hListBox DWORD NULL .CODE WinMain PROC ; first get the module handle call GetModuleHandleA, NULL mov [hInstance], eax ; create the listbox - if you're making this a child ;window, the middle NULL should be the ; handle of the parent and you include WS_CHILDWINDOW in ;the window styles... call CreateWindowExA,NULL,offset szListBox,offset szListBoxCaption,WS_VISIBLE OR LBS_STANDARD, \ 20,90,150,200,NULL,0,hInstance ,NULL; ; stash the handle to the ListBox mov [hListBox], eax ; make a call to hold things up so you see the listbox call MessageBoxA, NULL, offset szMBText, offset szMBCaption, MB_OK ; leave call ExitProcess, NULL WinMain ENDP ends end WinMain ###################################################### The formatting seems a bit distressed in this posting. If you want a more legible copy, email me. cheers, Mike =============================================== Subject: Combobox Selection Field Date: 2 Oct 1998 16:32:56 From: Mike Bibby Sorry about the formatting of the last posting. Also aline seems to have disappeared! It should read: ;----------------------------------------------------------------- ; The real prototype for CreateWindowExA should be: ; CreateWindowExA PROCDESC STDCALL :DWORD, :LPCSTR,\ ; :LPCSTR, :DWORD, :SDWORD,\ ; :SDWORD, :SDWORD, :SDWORD, \ ; :HWND, :HMENU, :HINSTANCE, :DWORD ;----------------------------------------------------------------- cheers, Mike =============================================== Subject: Combobox Selection Field Date: 2 Oct 1998 17:17:09 From: Ewayne Mike, I have all of that good stuff that you stated in fact I have a working combobox and listbox in my toolbar on my window program, but I need to save the selected item in the boxes to a string for later use. I think Hutch has me pointed in the right direction by sub classing the boxes, but I'm confused by his call to listbox. If it's a call to a create listbox proc, it doesn't look like the parameters match. Thanks Ewayne =============================================== Subject: Combobox Selection Field Date: 2 Oct 1998 17:42:12 From: Mike Bibby As I said, I think it's some kind of wrapper to CreateWindowEx, but we'll have to wait until he posts us the answer. I'm a bit puzzled as to exactly what you need, but to copy the currently selected item in a list box to a string use something like: ; find out what's selected call SendDlgItemMessageA, dhwnd, IDC_COMBO1, CB_GETCURSEL, 0, 0 ; ;put its string in szBuffer call SendDlgItemMessageA, dhwnd, IDC_COMBO1, CB_GETLBTEXT, eax, offset szBuffer I'll post you a zip of something that uses these ideas to run files. Cheers, Mike =============================================== Subject: MASM v611 Date: 2 Oct 1998 03:28:49 From: Rundus Hello Everyone Just installed Masm v611 Dos/Windows on my Win95 platform and made changes to Autoexec and Config files. Being a new user any Tips on setup and updating? I aware of v611d,v612 and v613 updates. I have asked this question due to time restraints rather than indolence. Any information at any level would be greatly appreciated. cheers Rundus :) =============================================== Subject: MASM v611 Date: 2 Oct 1998 11:54:20 From: Iczelion Good. A new MASM member :-) However you should know that link.exe that comes with masm 6.11 cannot be used to generate a dos program. If you want to assemble a DOS program, you should get MASM 6.0's link.exe. You should download MASM 6.13 patch. It can patch MASM 6.11x (except 6.11c) to patch level 6.13. You can download it from: ftp://ftp.microsoft.com/softlib/mslfiles/ml613.exe Run ml613.exe in your MASM directory, it will explode into several files. Run patch.exe and your MASM is instantly updated to 6.13. Good luck, Iczelion =============================================== Subject: MASM v611 Date: 2 Oct 1998 09:55:39 From: hutch Guys, If you are having problems with versions of ML.EXE, download the 6.11d version from Iczelion that came from the win89DDK, get the version of link that came with it and then run the 6.13 patch that you can also find on Iczelion's site. You also need CVTRES.EXE from either the DDK or VC5 to convert a normal RES file into an object module for linking with your program code. This will give you the latest versions of everything which will assemble and link program code and resources into win32 EXE programs. The rest is Rock 'n Roll missile ware. hutch =============================================== Subject: MASM v611 Date: 2 Oct 1998 04:09:05 From: TomServo Iczelion has been kind enough to post the 6.11-6.13 updates at http://203.148.211.201/iczelion/ (I didn't get em right my first try, need to get back to it. The ml.err file is screwed). One thought is if you have Visual C is to use Visual Studio to work on asm programs. I'm already used to and happen to like the enviroment, as it can handle multiple files and resources too. (Yeah, the resource files are the same for C as asm). I'm still getting the makefiles down for this, mostly problems with getting rc and makebsc to work from a build command (I can run em from a command prompt). =============================================== Subject: MASM v611 Date: 2 Oct 1998 05:29:05 From: Ewayne Tom I'm running ML 6.13 and the ML.ERR is dated 10-29-97 9,622 bytes and I haven't had any problems yet. If it is newer then yours and if would like a copy I'll E-MAIL to you Ewayne =============================================== Subject: MASM v611 Date: 4 Oct 1998 06:29:14 From: TomServo Ewayne, Thanks for your offer. I had a little time to play today, and got the 6.13 patch to work. My files are the same date as yours are. Tom =============================================== Subject: Possible to remove leading and trailing Date: 2 Oct 1998 10:07:08 From: Jason Hi, I am a beginner to assembly language. I am trying to write a small program to take user's input and center it to the screen. However, I would also like to take out those leading and trailing blanks before I center it. Is it possible to do that? I have enclosed my small program within this message. Please help. Thanks! Please reply me via email to geedo@iname.com page 59, 132 TITLE Simple program takes user's input and center it on screen ; Purpose: ; This program will Prompt the user to enter a phrase and then center it ; on the next line of video screen. Before center each phrase, ; the program will remove any leading and trailing blanks. If the entire ; phrase is blank, then just print a blank line. Blanks in the middle of ; the phrase will effect the centering. ; User may exit the program by type in "exit". The word "exit" is ; case sensitive. STACKSG SEGMENT PARA STACK 'Stack' DW 32 DUP(0) ;stack of 64 bytes, initialize to 0 STACKSG ENDS ;========================================================================= DATASG SEGMENT PARA 'Code' Users_Input LABEL BYTE Max_Size DB 127 ;126 characters plus 'enter' key Actual_Size DB ? Space_For_Input DB 127 Sentence DB 81 DUP (' ') Exit_Yes DB 'exit' ;variable for checking exit condition Line_Space DB 13, 10, '$' Error_Message DB 'Your sentence is too long! Please try again.',13, 10, '$' Prompt DB 'Please enter a sentence within 80 characters long:' CRLF DB 13, 10, '$' DATASG ENDS ;=========================================================================== CODESG SEGMENT PARA 'Code' MAIN PROC FAR ASSUME SS:STACKSG, DS:DATASG, CS:CODESG, ES:DATASG ;setup DS & ES with address of data a segment ;(CS & SS are handle automatically) MOV AX, DATASG MOV DS, AX MOV ES, AX ;clear the screen when program get started and setup the ;cursor position CALL CLEAR_SCREEN MOV DX,0000 CALL SET_CURSOR START: CALL PROMPT_AND_GETINPUT ;display prompt and store it to register ;check whether the input is bigger than 80 characters long. MOV BL, Actual_Size ;prepare BL register for comparing MOV BH, 00H CMP BL, 81 ;print error message if input is bigger than 80 characters. JG Print_Error_Message JMP NO_ERROR ;if no error, go ahead to center text Print_Error_Message: CALL PRINT_ERROR ;print error message JMP START ;after printing the error message ;re-prompt user for input NO_ERROR: CALL CHECK_EXIT ;check exit condition CALL SET_DELIMITER ;prepare phrase for centering CALL CENTER_TEXT ;center the text on screen CALL NEW_PROMPT ;make more space between the prompt ;and centered message JMP START DONE: ;end the program MOV AX, 4C00H INT 21H MAIN ENDP ;center phrase subroutine ;==================================================================== CENTER_TEXT PROC NEAR LEA DX, CRLF ;make a carrage returen line feed MOV AH, 09H INT 21H MOV AH, 03H ;read cursor position MOV BH, 00 INT 10H ;remove trailing blanks ;end remove trailing blanks ;remove leading blanks ;end remove leading blanks GO: MOV DL, Actual_Size ;locate center column SHR DL, 1 ;divide length by 2 NEG DL ;reverse sign ADD DL, 40 ;column position CALL SET_CURSOR ;set cursor position ;display user's input on screen MOV AH, 09H LEA DX, Space_For_Input INT 21H RET CENTER_TEXT ENDP ;subprocedure to set cursor position ;==================================================================== SET_CURSOR PROC NEAR MOV AH, 02H ;request set cursor MOV BH, 00 ;page #0 INT 10H RET SET_CURSOR ENDP ;subprocedure to prepare user's input string to center on the screen ;==================================================================== SET_DELIMITER PROC NEAR MOV BL, Actual_Size MOV BH, 00 MOV Sentence [BX], '$' ;set display delimiter RET SET_DELIMITER ENDP ;subprocedure to make a new line ;==================================================================== PRINT_CRLF PROC NEAR LEA DX, CRLF MOV AH, 09H INT 21H RET PRINT_CRLF ENDP ;subprocedure to prompt user and store phrase to register ;==================================================================== PROMPT_AND_GETINPUT PROC NEAR ;Prompt user LEA DX, Prompt MOV AH, 09H INT 21H ;get input from user LEA DX, Users_Input MOV AH, 0AH INT 21H RET PROMPT_AND_GETINPUT ENDP ;subroutine to check for exit condition ;==================================================================== CHECK_EXIT PROC NEAR ;scan for 'exit' CLD ;from left to right MOV CX, 4 ;scan four characters LEA DI, Space_For_Input ;load user's input LEA SI, Exit_Yes ;load string to compare REPE CMPSB ;scan for "exit" JE FINISH RET FINISH: ;end program MOV AX, 4C00H INT 21H CHECK_EXIT ENDP ;subroutine to clear the screen when program get started ;==================================================================== CLEAR_SCREEN PROC NEAR MOV AX, 0600H ;request scroll screen MOV BH, 07H ;black blackground, white foreground MOV CX, 0000 ;from 00,00 MOV DX,184FH ;to 24, 79 INT 10H RET CLEAR_SCREEN ENDP ;subroutine to make more line space before displaying the prompt ;==================================================================== NEW_PROMPT PROC NEAR CALL PRINT_CRLF MOV AH, 03H ;Read cursor position MOV BH, 00 INT 10H RET NEW_PROMPT ENDP ;==================================================================== MORE_LINE_SPACE PROC NEAR LEA DX, Line_Space MOV AH, 09H INT 21H RET MORE_LINE_SPACE ENDP ;subroutine to print error message ;==================================================================== PRINT_ERROR PROC NEAR CALL PRINT_CRLF MOV AH, 03H ;Read cursor position MOV BH, 00 INT 10H CALL MORE_LINE_SPACE LEA DX, Error_Message MOV AH, 09H INT 21H RET PRINT_ERROR ENDP DONE: ;end program MOV AX, 4C00H INT 21H CODESG ENDS ;======================================================================================== END MAIN =============================================== Subject: hooking of win32 api in a vxd Date: 2 Oct 1998 19:24:45 From: gnoof i'd like to intercept win32 api call in a vxd with Hook_Device_Service, to do this i need to load in eax the service id , where can i find a service list ? =============================================== Subject: hooking of win32 api in a vxd Date: 3 Oct 1998 07:34:58 From: TomServo You can get the VxD Service Ordinal from the service name using this API: #include DWORD dwServiceOrdinal = GetVxDServiceOrdinal(ServiceName); // Obtains the virtual device service ordinal, // for use by Hook_Device_Service. My question is what does this have to do with an API spy? It's designed to hook (say) INT 21 calls or such, very low level stuff. =============================================== Subject: String support API functions Date: 6 Oct 1998 03:14:39 From: Iczelion Dear Win32asm developers, I suggest you use Win32 string functions in case you want to do string operations. Finding the length of the string: --> lstrlen Compare two strings: --> lstrcmp, lstrcmpi Copy a string to other location: --> lstrcpy Concatenate two strings: --> lstrcat They're clean and easy to use. It'll make your program smaller and easier to maintain. Regards, Iczelion =============================================== Subject: String support API functions Date: 6 Oct 1998 09:41:35 From: MIke Bibby Definitely! They're what I use. You pre-empted me: I was going to use them in the next iteration of this thread. The primitive stuff was because I thought the "garbage" he was getting might have been due to a confusion between pointers and actual data and this would have illustrated the difference, plus a few new instructions. Cheers, Mike =============================================== Subject: windows 95 or 98 sdk Date: 6 Oct 1998 14:05:28 From: Brut where can I find the sdk for windows 95 or 98. I just purchased the book Windows Assembly Language and Systems Programming and it makes reference to the windows sdk. BTW this is a great book on assembly language programming for windows. If interested you can find it at amazon.com, do a search for assembly, ISBN 0-87930-474-X =============================================== Subject: windows 95 or 98 sdk Date: 6 Oct 1998 23:40:51 From: hutch just do a search in AltaVista for "platformsdk" and pick the site where you will get the best download time. Its about 50 meg or so but you get the full set of import libraries, later binaries, ML.EXE, LINK.EXE etc.. hutch =============================================== Subject: windows 95 or 98 sdk Date: 7 Oct 1998 14:37:04 From: Brut Thanks TomServo, I downloaded and installed it. It would be nice to have the documentation for it though. : Microsoft itself is now downloading the Win98 DDK, which has :all the .inc files of the SDK you could ever want. You need to be :registered for MSDN, but that's free. Yepper, they are finally :giving this away (it used to cost $500 to get em). Be careful, it :has a special version of link and ml (they are modified for :device driver use). : :http://msdn.microsoft.com/ =============================================== Subject: windows 95 or 98 sdk Date: 7 Oct 1998 03:24:32 From: hutch Brut, I slightly messed up the files, you will get the libraries and tools from the platformsdk. For the later versions of ML.EXE, LINK.EXE, CVTRES etc... you will need to download the WIN98DDK.EXE from the same source. Go back to msdownload and look for win98. I think Iczelion has this stuff on his ASM site. You will need to stuff the 6.13 upgrade through ML.EXE to bring it up from 6.11d to 6.13.7299 and I know that Iczelion has that upgrade on his ASM site. If you want to download the DDK make a few cups of coffee as it is a 19.5 meg download. hutch =============================================== Subject: windows 95 or 98 sdk Date: 8 Oct 1998 01:17:13 From: hutch Brut, You will need the platformsdk libraries as the DDK ones are not complete and sad to say, you will find the header files are very disappointing, if you check the WNDCLASSEX structures for example you will find that they differ in data size from the standard C, C++ that work correctly with the full DWORD data types. MASM is still not strong on the ground in terms of documentation. I use the PWB to access the alang.hlp help file for MASM specific syntax, PROTO, invoke, .if, etc... The data on mnemonics is best got from Intel as it is the most up to date and very comprehensive if you can suffer PDF format. Depending on your bandwidth access, an Altavista search on platformsdk will give youy a number of sites internationally to get the platformsdk files from. Good luck, hutch =============================================== Subject: Renaming files Date: 6 Oct 1998 21:42:35 From: Ghiribizzo Can someone tell me which API functions are needed to rename files (long filenames as well as short)? I can't seem to find anything in the API ref. I need this to automate a 'batch renaming'. Thanks. =============================================== Subject: Renaming files Date: 7 Oct 1998 15:36:18 From: Ghiribizzo :Ghiri: :You can use MoveFile or MoveFileEx to do this. : :-RudeBoy Thanks. I must have been using MSDOS for far too long! I might not have been so blinkered, had I used *NIX more :) -- Ghiri =============================================== Subject: Masm611-RC.exe Date: 7 Oct 1998 11:43:46 From: hutch ::Hello :: ::Is Rc.exe (Resources compiler)part of Masm or a stand alone program? :It's included in the MASM pack. I'm not sure if it's included in :Win98 DDK. The latest version I have seen is in the platformsdk. for what it is worth, any version over the last few years seems to work OK so there may be no great gain in chasing the latest. One thing, it is a good idea to run it with the /v option so that you can see if different resources have compiled properly. hutch =============================================== Subject: ReadFile Date: 9 Oct 1998 03:43:19 From: Ewayne In my learning program I'm reading text files and displaying them to the screen. I'm quite proud that it works fairly well, but I can't belive the amount of code it took to do such a simple task. Some questions. 1. When the file size is greater then the param. (number of bytes to read) it reads in a double buffer, is that normal or does it always try to double buffer? I had a hard time getting the right record to process when I read in the next block of records. 2. If the input file had tab stops the output display did not show any blank spaces where the tab stops were, is there a way to override that? 3. Is there a simple way to change the display font? I would like to change it to fixed width font, it would make controlling the word wrap more accurate then using tm.tmAveCharWidth. 4. I put a vertical scroll bar on my my main window, it's visible, but not functional??? 5. Last but not least, there has to be a better way of doing a readem and writem. I hate to think of using the same amount of code to write the display to disk. I've been reading about file mapping in memory, is that what I should be using? If so how do I get started, are there any samples available? =============================================== Subject: ReadFile Date: 9 Oct 1998 11:00:33 From: Iczelion :1. When the file size is greater then the param. (number of : bytes to read) it reads in a double buffer, is that normal : or does it always try to double buffer? I had a hard time : getting the right record to process when I read in the next : block of records. I don't know what you mean by "double buffer". :2. If the input file had tab stops the output display did not : show any blank spaces where the tab stops were, is there a : way to override that? Which API call did you use to output the text? :3. Is there a simple way to change the display font? I would : like to change it to fixed width font, it would make : controlling the word wrap more accurate then using : tm.tmAveCharWidth. You have to create a logical font first by calling CreateFont or CreateFontIndirect and select the newly created font into the device context. :4. I put a vertical scroll bar on my my main window, it's : visible, but not functional??? You have to process scrollbar messages such as WM_VSCROLL. It doesn't function automatically. :5. Last but not least, there has to be a better way of doing a : readem and writem. I hate to think of using the same : amount of code to write the display to disk. I've been : reading about file mapping in memory, is that what I should : be using? If so how do I get started, are there any samples : available? File mapping is indeed easier to use than WriteFile or ReadFile. You can read my tutorial about file mapping at http://win32asm.cjb.net =============================================== Subject: DrawText Date: 9 Oct 1998 21:54:39 From: Ewayne In my client window I have a menu and toolbar. I was using TextOut to write a buffer to my screen and I could control the x, y coordinates, which I could allow for the height of the menu and toolbar. Using DrawText I'm losing the first two lines of data, is there any way to allow for the height of the menu and toolbar. I need to use DrawText, because of additional functions it provides. Thanks, Ewayne paintem: push offset ps push hwnd call BeginPaint mov [DevCon],eax ;load device context push offset rect ;rectangle structure push hwnd ;window handle call GetClientRect ;get size of window push DT_EXPANDTABS or DT_WORDBREAK push offset rect ;device context push offset msgbuff ;buffer length push offset msgbuff ;address of input buffer push DevCon ;device context call DrawText =============================================== Subject: DrawText Date: 10 Oct 1998 00:53:14 From: hutch Ewayne, using GetClientRect() gives you the dimensions of the client area and DrawText() is drawing to the client area without allowing for the toolbar. This is why you are loosing a couple of lines. You will need to calculate the area where you wish to place the text, put it in a RECT structure and use that in the DrawText() call. Below is straight out of WIN32.HLP ------------------ lpRect Points to a RECT structure that contains the rectangle (in logical coordinates) in which the text is to be formatted. ------------------ Good Luck hutch =============================================== Subject: DrawText Date: 10 Oct 1998 03:12:58 From: Ewayne OK how do I change the RECT structure, I know what the coordinates should be and I've tried several different ways to change the structure, but it just smiles at me and doesn't change anything. Thanks, Ewayne =============================================== Subject: DrawText Date: 10 Oct 1998 03:37:21 From: Iczelion :::paintem: ::: push offset ps ::: push hwnd ::: call BeginPaint ::: mov [DevCon],eax ;load device context ::: push offset rect ;rectangle structure ::: push hwnd ;window handle ::: call GetClientRect ;get size of window mov eax,[height_of_toolbar] sub [rect.top],eax ::: push DT_EXPANDTABS or DT_WORDBREAK ::: push offset rect ;rectangle structure ::: push offset msgbuff ;buffer length ::: push offset msgbuff ;address of input buffer ::: push DevCon ;device context ::: call DrawText That's all modification you need. Iczelion =============================================== Subject: DrawText Date: 10 Oct 1998 04:51:49 From: Ewayne Thanks: everything looks good, except at the end of the first line there is a carrage return char. (|) that displays. Any clue? Using your tut12 example the file looks OK. Thanks, Ewayne =============================================== Subject: DrawText Date: 10 Oct 1998 05:49:37 From: Ewayne I found the problem. =============================================== Subject: Undocum.. erm.. Resource editor :) Date: 10 Oct 1998 12:09:39 From: hutch :Which is the best resource editor for win32 asm programming? :I know it's possible to 'hard-code' all menus in asm source, but :is't easier to use a resource editor. So, plase tell me which is :the best. : :Regards, :DynamiTe DaN Dan, You can get the Symantec 32 bit resource editor from Iczelions site and it works OK, has a bad habit of renumbering static controls where you type -1 to 65535 but does most things well. You are far safer to work in numbers with control IDs and you will need to strip the C++ junk out of the RC file that it generates. If you are writing in MASM, you will need the win98ddk utility, CVTRES.EXE to convert the RES file to an object module which you then link into the EXE. BRW45 works OK but has a piggish dialog editor and you will need to ask one of the TASM guys how to link it in with the Borland tools. Good luck, hutch =============================================== Subject: cvtres.exe Date: 10 Oct 1998 12:26:33 From: Iczelion :If you are writing in MASM, you will need the win98ddk utility, :CVTRES.EXE to convert the RES file to an object module which you :then link into the EXE. hutch, I haven't used cvtres.exe before but I can link the res file to the exe without any problem. Does cvtres.exe offer some advantage over the normal link method? Regards, Iczelion =============================================== Subject: cvtres.exe Date: 10 Oct 1998 20:32:16 From: hutch Iczelion, I use the coff linker out of the DDK and it does not have a documented syntax for resources binding. I knew from the technical data that resources in 32 bit PE files are linked in as obj modules so I tested the CVTRES utility and that is what it does, converts RES format files to coff modules. I don't know if that answers the question but I don't have the earlier version to compare it to. hutch =============================================== Subject: Linking Resources Date: 10 Oct 1998 20:53:08 From: RudeBoy when i use masm i just link the .res file, just put it on the command line to link like an object file. and as far as tasm goes, the .res file can be linked in directly also. after the import32.lib on the command line, you need two commas and then the name of your resource file. this is pulled from my makefile: tlink32 -x /V4.0 /Tpe /aa /c $(LINKDEBUG) (OBJS),$(NAME),, $(IMPORT),, $(RES) hope that helps, RudeBoy =============================================== Subject: Linking Resources Date: 11 Oct 1998 12:13:18 From: hutch RudeBoy, thanks for posting the TASM data. I am using the DDK link.exe and have no technical data for it as the options are different from the earlier OMF versions. It only has the command line help which does not give a syntax for linking RES as against OBJ files. Link /SUBSYSTEM:WINDOWS %1.obj rsrc.obj Link /SUBSYSTEM:WINDOWS %1.obj rsrc.res Linking either the RES or converted OBJ file works but I am left with no data as to why M$ supply CVTRES.EXE to do the conversion. When I have a bit more time, I will test a number of options to see why it is supplied. It may allow more than one OBJ with resources to be linked ? hutch =============================================== Subject: Invoke CreateFont Date: 12 Oct 1998 19:56:30 From: Ewayne Can I use invoke CreateFont to change the screen font if I'm using SendMessage to display the text on my screen? Thanks, Ewayne =============================================== Subject: Invoke CreateFont Date: 13 Oct 1998 01:21:57 From: hutch This following fragment is how you set a font for a control. invoke GetStockObject,SYSTEM_FIXED_FONT mov hFont, eax invoke SendMessage,hList,WM_SETFONT, hFont, 0 When you use CreateFont() you end up with a handle if the call succeeds which you have to select if you are doing GDI functions and deselect when you are finished with it. hutch =============================================== Subject: Invoke CreateFont Date: 13 Oct 1998 02:27:33 From: Ewayne I'm writting a file edit program that has a edit client window, which in turn I will output to a printer. I have the edit portion done and I have just started working on the print routine, but thats another story. But I would like the flexibility of using multiple fonts and sizes so I think I need to use CreateFont(). Tell me if I'm wrong. I think I have some of it figured out. Some questions. 1. Do I need a device context? If so how do I get it? I know how to get it my using BeginPaint(), but I'm using SendMessage() to write from memory to my client window. If I need it how do I use it? 2. Can you access a font default dialog box, like is available for open file and save file? =============================================== Subject: Invoke CreateFont Date: 13 Oct 1998 04:23:59 From: Ewayne This is the code I'm using to create a different font, it doesn't change anything. invoke ReadFile,hFile,pMem,MemSize-1,ADDR bytesread,NULL invoke GetDC,hwndEdit mov hEDC,eax invoke CreateFont,24,16,0,0,600,0,0,0,OEM_CHARSET,\ OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\ DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT,\ ADDR FontName mov hFont,eax invoke SendMessage,hwndEdit,WM_SETTEXT,NULL,pMem invoke SelectObject, hEDC, hFont invoke CloseHandle,hFile invoke GlobalUnlock,pMem invoke GlobalFree,hMem invoke ReleaseDC,hwndEdit,hEDC I've also tried placing the SelectObject() before the SendMessage(). =============================================== Subject: Invoke CreateFont Date: 13 Oct 1998 06:06:09 From: hutch ::I'm writting a file edit program that has a edit client window, ::which in turn I will output to a printer. Setting the font for a Richedit control can be done with the piece of code I pasted in, invoke SendMessage,hRichEdit1,WM_SETFONT, hFont, 0 The proc below will give you a multiline richedit control and if you use the commented out code in it to call the edit control, you set the font straight after you create the control. You can use the handle from CreateFont() to set the font for the richedit control. ;######################################################################### RichEdMl proc a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,hParent:DWORD,ID:DWORD ; RichEdMl PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD ;szText ReDLL,"RICHED32.DLL" ;<< this is a macro ;invoke LoadLibrary,ADDR ReDLL ;invoke RichEdMl,200,90,250,200,hWnd,800 ;mov hRichEd, eax ;invoke GetStockObject,OEM_FIXED_FONT ;invoke SendMessage,hRichEd,WM_SETFONT,eax,0 ;<< eax is handle ;invoke SendMessage,hRichEd,EM_EXLIMITTEXT,0,4000000 szText EditMl,"RICHEDIT" invoke CreateWindowEx,0,ADDR EditMl,0, WS_VISIBLE or WS_CHILDWINDOW or ES_SUNKEN or \ ES_MULTILINE or WS_VSCROLL or WS_HSCROLL or \ ES_AUTOHSCROLL or ES_AUTOVSCROLL or ES_NOHIDESEL, a,b,wd,ht,hParent,ID,hInstance,NULL ret RichEdMl endp ;######################################################################### ::2. Can you access a font default dialog box, like is available :: for open file and save file? It is just a common dialog box so you should be able to use it. :This is the code I'm using to create a different font, it doesn't :change anything. : : invoke ReadFile,hFile,pMem,MemSize-1,ADDR bytesread,NULL : : invoke GetDC,hwndEdit : mov hEDC,eax : invoke CreateFont,24,16,0,0,600,0,0,0,OEM_CHARSET,\ : OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\ : DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT,\ : ADDR FontName : mov hFont,eax : : invoke SendMessage,hwndEdit,WM_SETTEXT,NULL,pMem This should work unless the pMem is not a valid pointer. Try "invoke SendMessage,hwndEdit,WM_SETTEXT,NULL,ADDR pMem" to see if there is a difference. For large quantities of text you have to use SetWindowText() but just make sure you are passing an address for the text. If you are using GDI functions for display, you use Device Contexts but with a richedit control, the control has this functionality built in. Have a look at SelectObject() in win32.hlp for how and where it is used. I hope this makes sense, hutch =============================================== Subject: Invoke CreateFont Date: 13 Oct 1998 12:59:15 From: Ewayne The pointer to pMem is OK, because my edit program works fine. Am I using the SelectObject() properly to change the font? =============================================== Subject: CreateFont() works Date: 13 Oct 1998 13:57:25 From: Ewayne I put the "invoke SendMessage,hwndEdit,WM_SETFONT,hFont,0" in front of "invoke SendMessage,hwndEdit,WM_SETTEXT,NULL,pMem" and it works. If I use the common font dialog box in my program will my edit control have to be created using the RICHED.DLL? Thanks, Ewayne =============================================== Subject: CreateFont() works Date: 13 Oct 1998 22:23:58 From: hutch Ewayne, The font dialog box supplies you a font name which you can use for anything you like. EDIT v RICHEDIT depends on what you want to do. Richedit has built in drag & drop, will open much larger files and if you feel like climbing through win32.hlp, it will display formatted text, colors, fonts italic, bold etc... a subset of rtf. A normal edit control will do most things and is simpler. hutch =============================================== Subject: Common font dialog box Date: 14 Oct 1998 06:54:50 From: Ewayne Now that I have my CreateFont() working I would like to use the common font dialog box. I think I have a problem with my CHOOSEFONTA structure or something, because when I try to assemble my program I get a argument type mismatch. It also doesn't like my lpLogFont or lpfnHook. Thanks, Ewayne cf CHOOSEFONT INVOKE ChooseFont, cf <"error type mismatch" ******In my *.inc file ********** LOGFONTA STRUCT lfHeight DWORD ? lfWidth DWORD ? lfEscapement DWORD ? lfOrientation DWORD ? lfWeight DWORD ? lfItalic UINT ? lfUnderline UINT ? lfStrikeOut UINT ? lfCharSet UINT ? lfOutPrecision UINT ? lfClipPrecision UINT ? lfQuality UINT ? lfPitchAndFamily UINT ? lfFaceName UINT ? LOGFONTA ENDS LOGFONT TEXTEQU LPLOGFONT TYPEDEF PTR LOGFONTA CHOOSEFONTA STRUCT lStructSize DWORD ? hwndOwner HWND ? hDC HDC ? lpLogFont LPLOGFONTA <> iPointSize UINT ? Flags DWORD ? rgbColors COLORREF ? lCustData LPARAM ? lpfnHook LPCFHOOKPROC <> lpTemplateName LPCSTR ? hInstance HINSTANCE ? lpszStyle LPSTR ? nFontType WORD ? ___MISSING_ALIGNMENT__ WORD ? nSizeMin UINT ? nSizeMax UINT ? CHOOSEFONTA ENDS LPCHOOSEFONT TYPEDEF PTR CHOOSEFONTA CHOOSEFONT TEXTEQU ChooseFontA PROTO WINAPI :LPCHOOSEFONT ChooseFont TEXTEQU LPCFHOOKPROC PROTO WINAPI :HWND,:UINT,:WPARAM,:LPARAM,:UINT CF_SCREENFONTS EQU 00000001h CF_PRINTERFONTS EQU 00000002h . . . =============================================== Subject: Font dialog box Date: 14 Oct 1998 16:02:43 From: Ewayne I finally got the common font dialog box to come up, but when I select a font nothing happens. What am I missing? Is it passing something that I need to process? invoke GetDC, hwndEdit mov hEDC, eax mov cf.hDC, eax invoke ReleaseDC, hwndEdit, hEDC mov cf.lStructSize, SIZEOF cf push hWnd pop cf.hwndOwner push hInst pop cf.hInstance mov cf.Flags, CF_SCREENFONTS OR CF_EFFECTS mov cf.nFontType, SCREEN_FONTTYPE mov cf.lCustData, 0 mov cf.lpszStyle, NULL mov cf.nSizeMin, 0 mov cf.nSizeMax, 0 mov cf.lpTemplateName, NULL invoke ChooseFont, ADDR cf =============================================== Subject: Strange problem with threads Date: 14 Oct 1998 00:40:11 From: Ghiribizzo No one has replied to this, though after speaking with Owl, I believe that he is right in thinking that I have fallen into the trap of DOS asm programmers joining the multi-tasking world! I'll see if I have time to test his hypothesis. =============================================== Subject: Building Libraries Date: 14 Oct 1998 04:01:05 From: Rundus Helle Everyone Has anyone built a library from a Dll? Makebin /exports lib /def Options unavailable, hmmmm? =============================================== Subject: Building Libraries Date: 14 Oct 1998 04:16:08 From: Rundus Sorry! that should be Dumpbin /exports not Makebin /exports Oops! Those two options are unavailable. =============================================== Subject: Found one problem Date: 14 Oct 1998 07:24:04 From: Ewayne I forgot to put the ADDR in my invoke. call fontLoad INVOKE ChooseFont, ADDR cf The program assembles OK, but goes belly up when I execute ChooseFont. I'll do some more looking. Thanks, Ewayne =============================================== Subject: Most recent Win32.hlp file? Date: 14 Oct 1998 12:49:10 From: g I've got a win32.hlp file that came with Delphi 3 but there are several (well, lots in fact...) prototypes in the header files (from the most recent 'build environment' from MS) that I can't find in it. Anyone know where I can get an updated version from? I just finished winbase.inc and I've got a load of functions that I've no idea what they do or what group they're in, etc. l8r, g =============================================== Subject: Most recent Win32.hlp file? Date: 15 Oct 1998 09:39:22 From: hutch g, I think the one that come with the shovelware Borland C++ Builder is later. The one in delphi is only a beta. I think Iczelion has a link to a later version but anywhere you get it is a 7.5 meg download. hutch =============================================== Subject: Most recent Win32.hlp file? Date: 15 Oct 1998 11:39:45 From: Rundus What is the size and date of the file? That way I can check my win32.hlp to see if it a newer version. =============================================== Subject: Logfont problems Date: 14 Oct 1998 21:58:06 From: Ewayne I think I need to process the logfont structure after I return from choosefont() and then do a createfont() with that information. Tell me if I'm wrong. I would try it, but I have a problem with the lpLogFont parm. in my CHOOSEFONT structure, I've been bypassing it by using a DWORD in place of the pointer to the LOGFONTA structure. I get a syntax error when I put the pointer in to the LOGFONTA structure. HELP! LOGFONTA STRUCT lfHeight DWORD ? lfWidth DWORD ? lfEscapement Dword ? lfOrientation DWORD ? lfWeight DWORD ? . . . LOGFONTA ENDS LPLOGFONT TYPEDEF PTR LOGFONTA LOGFONT TEXTEQU lpLOGfontA PROTO WINAPI :LPLOGFONT lpLogFont TEXTEQU CHOOSEFONTA STRUCT lStructSize DWORD ? hwndOwner HWND ? hDC HDC ? lpLogFont LPLOGFONTA *** syntax error *** . . . CHOOSEFONTA ENDS Thanks, Ewayne =============================================== Subject: SHMalloc and IMalloc.Free Date: 15 Oct 1998 01:28:45 From: Jubee hi, I would like to use the SHBrowseForFolder but i've this problem: i need to know how to call the IMalloc->Free (the task allocator) and more generally how to declare/use an ole interface in asm. Any idea? tnx in advance, Jubee kaneda27@hotmail.com =============================================== Subject: Whats Masm32 do?? (from Iczelions wi Date: 15 Oct 1998 08:56:04 From: hutch :I noticed on Iczelions web page that there is a file Masm32. What :is this file and how do you set it up?? Make a directory called masm32, copy the masm32.exe file into it and expand it. You need the platformsdk import libraries for it. Copy them into the LIB directory and then run a batch file from the INC directory to build the INC files. If you have everything set in the right place, start the editor called QEDITOR.EXE and change to the TEMPLATE directory and load TEMPLATE.ASM. It will build with no errors or warnings if all the files are there. If you have any problems, email me at above address. hutch =============================================== Subject: Whats Masm32 do?? (from Iczelions wi Date: 17 Oct 1998 00:11:48 From: Linuxjr Worked like a charm hutch now one quick question. I was looking through the examples and the template file. I was noticing some minor differences between some win32 tutorials I saw or is it the same as masm?? I am not use to it a whole lot used some other assemblers. Any help is appreciated and what documents would help me now what is in the include and libarary files?? Meaning what do I include for graphics or set up a text box etc etc. Again thanks. Linuxjr =============================================== Subject: Direct Draw demo Date: 15 Oct 1998 12:56:14 From: Mike Bibby Someone just emailed me for this, but I've mysteriously lost their email (or, more likely, stupidly deleted it). So, if you haven't had a reply from me, could you resend your message, please? (Everyone else who asked should have it by now.) And if anyone else wants a DirectDraw demo (TASM and MASM), mail me. I'll try to be more efficient! Cheers, Mike =============================================== Subject: Pointer within structure Date: 15 Oct 1998 13:58:43 From: Ewayne How do you point to another structure from within a structure? LOGFONTA STRUCT lfHeight DWORD ? . . . . LOGFONT ENDS LPLOGFONT TYPEDEF PTR LOGFONTA LOGFONT TEXTEQU lpLogFontA PROTO WINAPI :LPLOGFONT lpLogFont TEXTEQU CHOOSEFONTA STRUCT lStructSize DWORD ? . . . lpLogFont LPLOGFONTA <> *** This doesn't work I get a syntax error **** . . CHOOSEFONTA ENDS =============================================== Subject: Pointer within structure Date: 15 Oct 1998 19:02:43 From: Mike Bibby Here's a little MASM demo of a way to use a pointer within a structure. Cheers, Mike ; MStruct1.asm Mike Bibby 15.10.98 ; A round the house example... showing pointers ; within structures. ; We have two structures each containing a string and ; a pointer to the other structure. ; We print out the string of the first structure by ; getting a pointer to that first structure from the second, ; and then using that pointer to find the address ; of the string within the first. ; It's just a demo, not an exemplar! .586 .model flat, stdcall ;============= non-typed protoypes ============================= ExitProcess PROTO STDCALL :DWORD lstrcpy PROTO STDCALL :DWORD,:DWORD MessageBoxA PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD ;================== structures and typedefs =================== LPMYSTRUCTURE typedef PTR Structure Structure STRUCT pointer LPMYSTRUCTURE 0 ; pointer to structure of same type identString BYTE 32 dup (0) ; field for a string Structure ENDS MYSTRUCTURE typedef Structure ;============================================================== .data first MYSTRUCTURE second MYSTRUCTURE szFirst DB "First string",0 szSecond DB "Second string",0 szCaption DB "Structures with pointers",0 ;============================================================== .code start PROC ; copy first string into first structure lea eax, szFirst lea ebx, first.identString invoke lstrcpy, ebx,eax ; copy second string into second structure lea eax, szSecond lea ebx, second.identString invoke lstrcpy, ebx,eax ; make the second structure's pointer point to the first lea eax, first mov second.pointer, eax ; ... and vice versa lea eax, second mov first.pointer, eax ; our structures have been set up, now let's get at the string in first ; via the pointer in second... ;we read into eax what's in second.pointer, which is a pointer to structure first mov eax, [second.pointer] ; we get into eax the address of the identString belonging to first by ; dereferencing the pointer and indexing it with identString lea eax,[eax+Structure.identString] ; and now we print it out... invoke MessageBoxA,0,eax,offset szCaption,0 ; and now we leave... invoke ExitProcess,0 start ENDP END start =============================================== Subject: Win32asm project Date: 15 Oct 1998 20:20:38 From: Ghiribizzo I've uploaded a softice tool to: http://www.chocbar.demon.co.uk/ghiribizzo/sicetool.zip The program is currently written in Delphi and I am considering to write it as win32asm. Is anybody interested in collaborating on this? If so, does anyone have a suggestion to the best way of doing this? It is possible to code in such a way as to be able to compile on both MASM/TASM. If you're interested, please reply here. BTW, i can't release the patch data (though you can try to eek it out of the EXE itself) however i will put the patch data into the finished program and try to get the donator to give permission to publish. The bulk of the work is getting a GUI that will more than rival the Delphi one. (well, we can't have Delphi apps being nicer can we? ;) =============================================== Subject: Win32asm project Date: 16 Oct 1998 19:45:08 From: RudeBoy i'd be interested in working on this Ghiri... i run winnt though, and that might cause some problems as far as testing the patch data. LMK (via email, i don't know if i'll be on irc at all) RudeBoy =============================================== Subject: Convert rgbResult Date: 16 Oct 1998 17:39:48 From: Ewayne How do you convert the rgbResult return from the ChooseColor() call. I've tried a decimal convert, but that didn't do much for me. I would like to take the result and do a SetTextColor() call to change the color of the text. Thanks, Ewayne =============================================== Subject: WinDASM and DLLs Date: 19 Oct 1998 09:24:17 From: Tiberius (NikanA) Hi, I recently tried to disassemble a DLL using WinDASM 8.9 and it claimed the file size after disassembly was 0 bytes when in fact the DLL was 272K. What could be the reason for WinDASM choking on it? Could it be compressed? I never saw this before disassembling any DLL. Hmmmmmm. =============================================== Subject: WinDASM and DLLs Date: 20 Nov 1998 09:10:25 From: GouGe You can compress DLL files with various programs like: pe-cRYPT Pe-shield WinCrypt32 If you want to disam your DLL file you need an uncrypter like NoCrypt.... This baby deencrypts and unzips almost 243 kind of package.... Like check out alt.hacknet.UHF.com United Hackerz Forze FTP Regardz, GouGe ^United Hackerz Forze =============================================== Subject: Rudeboy's W32.inc Date: 19 Oct 1998 10:39:51 From: "Mr.BlacK" I recently downloaded The Rudeboy's [PC98] asm template for a keygen in win32asm (TASM). It uses an include file called w32.inc which is not the usual one. The Rudeboy says it can be found in its page. Does anybody know the URL or has that include file? if so, please tell/send me info on it If possible, CC the response to my mail address, because I don't usually have access to the Web, but i can easily access my mail. Greetings 2 everyone and happy codin'!! Mr. BlacK [WkT!] =============================================== Subject: Rudeboy's W32.inc Date: 19 Oct 1998 18:44:25 From: RudeBoy Well, my original webpage on xoom was censored, even though there was no illegal content on there, only my own source and freely available utilities. I have a new site up at http://rude.8m.com (i know that it's slow, sorry, of course if you want to donate a little space for me it would be easier to expand my site and better for people who want to view it ;) In the Asm Source section you can find the w32.inc file that I used when compiling that prog. Enjoy! The RudeBoy (not with pc98 anymore Mr BlacK ;) =============================================== Subject: Rudeboy's W32.inc Date: 23 Oct 1998 01:19:20 From: RudeBoy :: I have a new site up at http://rude.8m.com : :And in which intervall is this accessable? hahahaha....i dunno, that site is up/down and really slow, hopefully i'll have another site up soon...but i don't know how long it will be :( -RudeBoy =============================================== Subject: Print text files Date: 19 Oct 1998 14:42:47 From: Ewayne I have a need to print text files from my application. I've tried using PrintDlg() to get the printer handle, CreateFile(), and WriteFile() or WritePrinter() and all I manage to do is zapping my text file. I'm I taking the right approach? Are there any examples? I can print a string using TextOut(), so I know I can access my printer. Thanks, Ewayne =============================================== Subject: Print text files Date: 19 Oct 1998 19:52:14 From: Ewayne :I have not tried to do this, but I am wondering why you are using :writefile?? Shouldn't you be using createfile, then readfile? : :The RudeBoy I'm learning and I'm getting confused trying to print a text file I did try using readfile() also. Any help would be appreciated. Thanks, Ewayne =============================================== Subject: keyboard input in a console Date: 19 Oct 1998 15:43:06 From: "d'jln" hello! What is the piece of code to get strings from the keyboard in a win32 console? I know it's through GetStdHandle as echoing strings to the console, but when reading, we don't know how many chars we will read. === Echo proc push large 0 push offset BytesWritten push ecx push esi push large STD_OUTPUT_HANDLE call GetStdHandle push eax call WriteFile ret Echo endp === =============================================== Subject: Print problem Date: 20 Oct 1998 11:21:00 From: Ewayne What are the steps needed to print a text file? I have the file loaded in memory. I've figured out how to print a string using TextOut(), but that's not what I need. Thanks, Ewayne =============================================== Subject: Dos Boxes in TASM W32asm applications Date: 20 Oct 1998 11:23:20 From: "Mr.BlacK" I have made a proggie which is supposed to be a win32 application, with dialogs and so on... Whenever I launch it from Win95 an UGLY DOS BOX appears which i'd like to remove. I suppose that i compile it as a console application and that's the cause for it to appear. Any help in this matter would be extremely appreciated. Best regards, mr. BlacK [WkT!] =============================================== Subject: Dos Boxes in TASM W32asm application Date: 20 Oct 1998 12:51:56 From: hutch Just tweak the part of the PE header from 03h to 02h to make it a GUI app. Its a bit rough but it will do the job until you can assemble it as a GUI. hutch =============================================== Subject: Can I call undocumented API? Date: 20 Oct 1998 18:54:01 From: zcho I need call one Windows95 API from kernel32.dll, but in kernel32.lib it not found. I know how on Delphi do it but on ASM. HELP plz! =============================================== Subject: Can I call undocumented API? Date: 20 Oct 1998 23:15:06 From: hutch If you dump kernel32.dll, you can check if it is in the exports, if it is then you should know the sizes of the parameters from using it in Delphi. Depending on which assembler you are using, if you use the EXTERN syntax or similar, you should be able to call the function you need. You should also be able to use the, LoadLibrary() GetProcAddress() functions to call the API out of kernel32.dll. Be careful with this much that if it is in win95 but not in the win98 libraries, M$ may have changed their mind so it may not work on win98 or later NT. hutch =============================================== Subject: Can I call undocumented API? Date: 30 Oct 1998 06:24:59 From: lucifer hmm... cant you just add the fuction to the .def file like this: IMPORTS Kernel32.FunctionName and just add this to the source fike: EXTRN FunctionName:PROC lucifer =============================================== Subject: windows.inc file for win 32 asm. Date: 20 Oct 1998 23:54:56 From: hutch I have posted at the address below, the latest version of the windows.inc file for the MASM32 package. It has more equates and structures and has had some data size errors corrected. It should work with TASM as well so that if the TASM programmer uses the l2inc.exe utility, they will have a reasonably complete set of equates, structures and prototypes for win 32 programming. I have also posted a file called ctypes.inc to assist in porting C code to 32 bit asm. It has been converted from a file written by Sven B Schreiber and has the 60 or so C/C++ data types. Hope its useful to you. http://www.pbq.com.au/home/hutch/masm.htm =============================================== Subject: EM_FINDTEXT or EM_FINDTEXTEX Date: 22 Oct 1998 04:30:45 From: Ewayne How do you use either the SendMessage for EM_FINDTEXT or (EM_FINDTEXTEX for RICH EDIT). I've initiated my FINDREPLACE STRUCT, then do a call to FindText() to bring up the common find dialog box, enter a search string initiate my CHARRANGE STRUCT and FINDTEXT STRUCT or FINDTEXTEX STRUCT, and do a SendMessage for EM_FINDTEXT or EM_FINDTEXTEX pointing to either the EM_FINDTEXT or EM_FINDTEXTEX and it does not find the text. Thanks; Ewayne =============================================== Subject: EM_FINDTEXT or EM_FINDTEXTEX Date: 22 Oct 1998 11:24:20 From: Ewayne :Ewayne, : :make sure you match the EM_FINDTEXT message with the correct :structure FINDTEXT STRUCT. The same with EM_FINDTEXTEX to :FINDTEXTEX. : :Fill your CHARRANGE structure with a set of values to test it and :then do the SendMessage() call. If you can break in down into :parts and test it piece by piece, you should be able to isolate :where the problem is. : :hutch It looks like it is not recognizing the find next button. I have done a (INVOKE RegisterWindowMessage, ADDR FMsg) where FMsg is (FMsg db 'EM_FINDTEXT',0) before the FindText() call, and in my message loop I'm checking for FMsg. Thanks; Ewayne =============================================== Subject: RegisterWindowMessage Date: 22 Oct 1998 18:00:38 From: Ewayne How do you invoke the RegisterWindowMessage()? Is this the right way? RCode dd 0 FMsg db 'EM_FINDTEXT',0 . . . INVOKE RegisterWindowMessage, ADDR FMsg INVOKE FindText, ADDR fr mov RCode, eax . . . INVOKE SendMessage, EM_FINDTEXTEX, NULL, NULL, ADDR ftx I use the RCode in my message loop and my program doesn't recognize the findnext button on my findtext dialog box. =============================================== Subject: SetDlgItemInt and printing Date: 27 Oct 1998 22:59:24 From: David :I have seen in 'Programming Windows 95' a reference to a macro :called atoi. It seems to me that there should also be a macro for :itoa. I am using TASM5.0 and have no info on macros. Does anyone :have this code. Thanx. Dave : :Dave, : :I think itoa & atoi are C runtime library functions, I cannot find :them in win32.hlp so you may have to write them. : :As far as macros, I think TASM will run MASM style macros but you :will have to check with one of the TASM guys for that. : :hutch I referred back to my college book on assembly programing and found a little sample pgm converting binary to ASCII. I adjusted if for 32 bits and it works. The labels are now displaying the Cont # correctly. Thanx for respondig. Dave =============================================== Subject: low-order word Date: 27 Oct 1998 23:05:41 From: Ewayne How do I extract the low-order or high-order word from a DWORD and put the results back into a DWORD? Thanks, Ewayne =============================================== Subject: low-order word THANKS Date: 28 Oct 1998 01:45:29 From: Ewayne :Ewayne, : :treat the DWORD as a 4 byte array 00 00 00 00 with offsets 0 to 3 :and then read it into a word size variable. There are variations :depending on whether its a memory operand or a register but its :logic is pretty straight forward. : :In a proc, : :LOCAL Var :DWORD : :Perform some action where the DWORD value Var is filled with the :DWORD value you want and the use something like, : :mov ax, Var[0] :push ax :xor eax, eax :pop ax : :or : :mov ax, Var[0] :cwde ; sign extend ax to eax : :hutch Works great. Thanks, Ewayne =============================================== Subject: (no subject) Date: 30 Oct 1998 16:32:51 From: RudeBoy :I was just curious. Are there any sites with some simple source :codes for some encryption in assembly?? Any help will be :appreciated. : :Linuxjr Check Stone's site at http://www.cracking.net The RudeBoy =============================================== Subject: (no subject) Date: 30 Oct 1998 23:20:36 From: Ghiribizzo Simple XOR encryption can be found in virii sources. Also, on my site there is an asm implementation of RC4. If you're writing a windows program and are interested, I could finish the DLL I am writing which will allow RC4 routines to be called. =============================================== Subject: New Direct Draw Demo Date: 31 Oct 1998 16:03:19 From: Mike Bibby I've got a new Direct Draw Demo that includes a full (alpha) inc file for both TASM and MASM plus a simplified way to call the methods. Those who've already asked for it should have it by now. If not, or anyone else who wants a copy, just email me. Cheers, Mike =============================================== Subject: Coding for different printers Date: 3 Nov 1998 14:00:35 From: Dave I am writing a DB pgm which needs to print labels. In order to maintain consistency for a standardized label size, I need a mechanism for controlling the font size and spacing for any printer the user may have connected. The ASM 32-bit code I have written prints the data too large and with too great a spacing on my inkjet at home, but at work, on a laser printer, the character size as well as spacing is perfect, but the rows of data overlap and the spacing between the info for one label and the next is too close. Although 'Progamming Windows 95' provides a wealth of info on fonts, it seems to be more geered to video and I cannot see the correlation to printing. Any references or assistance would be greatly appreciated. Thanx. Dave =============================================== Subject: Pop_up Menu Date: 3 Nov 1998 19:23:52 From: Ewayne How do you create a pop_up menu for a rich edit control using a right mouse click? Thanks, Eeayne =============================================== Subject: Pop_up Menu Date: 3 Nov 1998 21:20:17 From: hutch Ewayne, your lucky, I just tweaked this one yesterday so I knew where it was. Case WM_RBUTTONUP GetClientRect Edit1,ByVal VarPtr(Rc) TrackPopupMenu GetSubMenu(hMnu,3),TPM_LEFTALIGN or TPM_LEFTBUTTON,LOWRD(lParam),HIWRD(lParam),0, hWnd,ByVal VarPtr(Rc) This goes in the subclass procedure for the richtext edit control. Translate VarPtr(Rc) as ADDR Rc hMnu is the main menu handle, 3 is the zero based index of the submenu It is easy to get to work which is a change from most windows stuff hutch =============================================== Subject: SH3 Compiler Date: 4 Nov 1998 23:35:02 From: Ghiribizzo Does anyone know where I can get hold of an SH3 cross-compiler (for writing WinCE proggies)? =============================================== Subject: Createwindowexa - dwStyle Date: 5 Nov 1998 16:01:49 From: Arrowfrog For the dwStyle in the function CreateWindowExA, there are many styles eg WS_OVERLAPPEDWINDOW. I wish to ask what is WS_OVERLAPPEDWINDOW represented by in assembly code. I mean is it push 00000001 or push 00100000 or others. How do I combine several styles to get the push no. Where can I get reference for this? =============================================== Subject: Createwindowexa - dwStyle Date: 5 Nov 1998 18:05:52 From: hutch If you have a look in win32.hlp under CreateWindow, you will see a lot of different styles for different types of windows. You normally OR the styles together to get the combined attributes you want so that what you are passin to the function is a single DWORD size number. invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR lstBox,0, WS_VSCROLL or WS_VISIBLE or \ WS_BORDER or WS_CHILD or \ LBS_HASSTRINGS or LBS_NOINTEGRALHEIGHT or \ LBS_DISABLENOSCROLL, a,b,wd,ht,hParent,ID,hInstance,NULL This is a piece of high level MASM but it shows how the styles are combined. Each style has an equate which is just DWORD size. You will have to check in your header file to see what equates you have but the operation is straight forward. hutch =============================================== Subject: Createwindowexa - dwStyle Date: 5 Nov 1998 17:24:12 From: Dave :For the dwStyle in the function CreateWindowExA, there are many :styles eg WS_OVERLAPPEDWINDOW. I wish to ask what is :WS_OVERLAPPEDWINDOW represented by in assembly code. I mean is :it push 00000001 or push 00100000 or others. How do I combine :several styles to get the push no. Where can I get reference for :this? Look at your windows.inc file for this info. In this particular case WS_OVERLAPPED EQU 00000000h. =============================================== Subject: Createwindowexa - dwStyle Date: 6 Nov 1998 15:52:18 From: Arrowfrog Where do I get the "windows.inc" file? To hutch - which header file are you talking about? Where do I get it? =============================================== Subject: Createwindowexa - dwStyle Date: 6 Nov 1998 22:25:34 From: hutch ArrowFrog, "windows.inc" on my home page at, http://www.pbq.com.au/home/hutch/masm.htm There is also a ultility l2inc.exe which makes include files from the sdk libraries for the APIs in either TASM or MASM syntax. The windows.inc file has a very large set of equates and structures. hutch =============================================== Subject: Selecting a Line of Text Date: 5 Nov 1998 17:59:17 From: Ewayne I have a rich edit client control that I have offset to the right 8 pixels from the parent window, so that the characters are not at the edge of the window. The only way that I can select text is to left click and move the mouse over the desired area. I would like to be able to position my cursor to the left of a line of text and left click to select that line of text like other editors do. When I move my cursor to the left of my text the cursor does not change to a ARROW. I have loaded IDC_ARROW and loaded its handle in the WndClass structure before I call RegisterClass(). Thanks, Ewayne =============================================== Subject: Selecting a Line of Text Date: 5 Nov 1998 18:12:46 From: hutch Ewayne, invoke SendMessage,hRichEd,EM_SETOPTIONS,ECOOP_XOR,ECO_SELECTIONBAR Send this message after your CreateWindow call and you set a left side margin that you can select in line mode with. You will see the mouse cursor change as it goes over the selection area. Make sure your header file has the equates for the values, if not you can get my latest "windows.inc" from my home page. http://www.pbq.com.au/home/hutch/masm.htm hutch =============================================== Subject: my site Date: 6 Nov 1998 12:31:48 From: TomCat/Abaddon :I've reorganised my site. :It's worth to visit despite it's in Hungarian. : :http://rs1.szif.hu/~tomcat/win32 Now it's in English!!! (mail me if you have problems with the format of this page) TC. =============================================== Subject: Where can I find masm header files? Date: 6 Nov 1998 14:45:16 From: hutch :I am curious where to find copies of masm header files? My :computer crashed last night and I am rebuilding everything and :was wondering where I can find a copy of the masm\include\*.h :files. Any help will be appreciated. Speedy, your welcome to the windows.inc file on my home page from the MASM32 package. It is the latest one I have done. http://www.pbq.com.au/home/hutch/masm.htm You can do the full set from the l2inc.exe utility on there as well. hutch =============================================== Subject: EM_GETLINE Date: 6 Nov 1998 16:04:37 From: Ewayne Whats the trick to get the EM_GETLINE to work. I can get the selected line number, the length of the line, and the total number of lines using (EM_*) messages, but I get a return value of 0 when with EM_GETLINE, the line number input looks OK. Thanks, Ewayne =============================================== Subject: EM_GETLINE Date: 6 Nov 1998 22:33:53 From: hutch Ewayne, the following is out of a compiler but you'll get the idea. You'll have to do the string allocation as BYTE and make sure its big enough for the line length you want to put into it LOCAL Cr as CHARRANGE LOCAL Buffer$ rv&= SendMessage(hndl,%EM_EXGETSEL,0,VarPtr(Cr)) ind&=SendMessage(hndl,%EM_LINEFROMCHAR,Cr.cpMin,0) ll&= SendMessage(hndl,%EM_LINELENGTH,Cr.cpMin,0) Buffer$=space$(ll&) SendMessage hndl,%EM_GETLINE,ind&,ByVal StrPtr(Buffer$) It typical M$ but it works OK hutch =============================================== Subject: LOGFONT structure Date: 9 Nov 1998 00:48:41 From: Dave The LOGFONT structure in the SDK shows as the last parameter CHAR lf_lfFaceName[LF_FACESIZE] Can anyone tell me how to convert this to terminology TASM understands. I get an error msg for this when assembling. Thanx. david11372@aol.com =============================================== Subject: LOGFONT structure Date: 9 Nov 1998 03:28:59 From: hutch Dave, it just looks like a zero terminated string that has the name of the type face. To test it, I would try something like, FaceName db "Arial",0 in the data section and use something like, mov lf.lfFaceName, FaceName when you are loading data into the LOGFONT structure. win32.hlp ~~~~~~~~~ lfFaceName A null-terminated string that specifies the typeface name of the font. The length of this string must not exceed 32 characters, including the null terminator. The EnumFontFamilies function can be used to enumerate the typeface names of all currently available fonts. If lfFaceName is an empty string, GDI uses the first font that matches the other specified attributes. =============================================== Subject: LOGFONT structure Date: 10 Nov 1998 03:58:56 From: Dave Thanx Hutch, I'll give it a try. Comparing what you've suggested with the C code in "Programming Windows 95' looks very similar, however, the CD with the book doesn't show his .h file, so I wasn't sure if the statement HAD to be in the structure definition or not. Thanx again. Dave Hutch, how do I define lf.lfFaceName in the structure and also since I am trying to use the function CreateFontIndirect, there is only one parameter OFFSET lf, but how do I define this parameter in my .INC file. Everything I've tried (LPLOGONT, DWORD, LPCSTR, etc.) gives me an 'unresolved external' error msg when I try to assemble. Thanx. Dave =============================================== Subject: LOGFONT structure Date: 10 Nov 1998 05:57:10 From: hutch Dave Try this structure in your INC file, LOGFONT STRUCT lfHeight DWORD ? lfWidth DWORD ? lfEscapement DWORD ? lfOrientation DWORD ? lfWeight DWORD ? lfItalic BYTE ? lfUnderline BYTE ? lfStrikeOut BYTE ? lfCharSet BYTE ? lfOutPrecision BYTE ? lfClipPrecision BYTE ? lfQuality BYTE ? lfPitchAndFamily BYTE ? lfFaceName DWORD ? LOGFONT ENDS In your .data section try, lf LOGFONT <> szFontName db "Arial",0 ; or similar and in your code, load the members of the structure with the data you want. load the lfFaceName member with, mov lf.lfFaceName, offset szFontName and give it a try. Hope it works OK. hutch =============================================== Subject: terminating threads while threads are st Date: 11 Nov 1998 01:23:14 From: ani [labored question]: WinProc recieves wm_destroy and issues bThreadKill = TRUE when the thread is currently running and inside a DLL function that hasn't returned yet, WinProc will always be in a poll in "while (iThreadsRunning > 0);" If the thread doesn't call an external DLL's function, it will always complete the decrement of "iThreadRunning" on thread exit. Could someone point me to some source of information about this problem? Appendix 1: The external test DLL function executed "Sleep (5000)" and returns back to the thread in normal conditions. However, if terminating the main window, it seems like it never returns. Appendix 2: Adding an Enter and Leave critical sections in the test thread and also to the WinProc's "while (iThread...)", I've noticed that the Enter before "while..." got called, however, the break point at the "while..." never got called. =============================================== Subject: Problem with DialogBoxes.. Date: 10 Nov 1998 09:37:49 From: The+Q Greetings everyone. I've build up a nice dialog-box (Created .RC file with BRW), and executed it with DialogBoxParamA . Bare in mind , all the proggi is this dialogbox, no other controls/forms. Now here's the strange prob. - Sometimes it runs, and sometimes it returns -1 (error) with dialogboxparam , and doesnt run. Have u ever encoutered this prob ? Is there something undocumented about dialogboxes ?? Working with Dialog Box can save a lot of programming time, so I aprecheate any response. Thank you, The+Q =============================================== Subject: Dialog prob.. fixed.. Date: 10 Nov 1998 17:01:32 From: The+Q After some work i've found the problem it was in my .RC file . I creacted it with BRW (for win3.11) and it made controls that win98 don't support .. Anyway , it's fixed .. but thanks anyway ;) later, The+Q =============================================== Subject: DDE problem when exec. from DLL Date: 11 Nov 1998 18:22:02 From: ani Uh oh... I left out one very important aspect... (guess it was too late at night :) When the DLL calls a DDE service just to "DdeConnect" during the time that the user sent an WM_CLOSE to the main window, DdeConnect freezes. I just added #5 pointer to the bottom (scroll down it's in TestFunc). DDESend is really a function that connects to a server via "DdeConnect" and then XTYP_POKE the data, and DdeDisconnect. Gosh, sorry if I've left out this big clue :) The problem isn't the DLL function not being able to return, it's the DLL function not being able to return because of "DdeConnect" if and only if the user issued a WM_CLOSE. I'm not sure how DDEML keeps a tab of anything, but it shouldn't freeze at all! If the DdeConnect was made in the TestWorkerThread at #3, it will work--amazing. My workaround got me to send a pointer of DDESend to the TestFunc in the DLL. I didn't know if the DLL was dying or anything when it tried to call DdeConnect when the main program/thread already got issued WM_CLOSE / WM_DESTROY. So, this pointer used the main program's own DDE connection. This means that the main window/program handles all DDE itself. Now we can rule out that the DLL TestFunc had problems of anything related to initializing it's own handles when connecting with DdeConnect and etc. All the DLL TestFunc at #5 is to jump to the main program's own DDESend, the real one. The expirement came out to be the same. When the program was closing up, any accesses to DDESend from the DLL froze/crashed while the same DDESend executed from inside the main program (#3) worked fine. Something tells me that the DDEML doesn't allow DLLs to use DDE. Anyone got any bright ideas?? My bulb just went out . . . In article <72b89l$tqu$1@nnrp1.dejanews.com>, wribak@usa.net wrote: > > > I'm having problems waiting for threads to terminate in WM_DESTROY when those > threads are in the DLL functions that they called. Here's a rough idea of > what I mean and this problem isn't something you would run into everyday: > > WndProc begin > > WM_CREATE: > iThreadsRunning++; > _beginthread (TestWorkerThread, 0, NULL); > return 0; > > WM_DESTROY: > while (iThreadsRunning > 0); <<-- #1 polling forever > PostQuitMessage (0); <<-- #2 never reached > return 0; > > WndProc end > > TestWorkerThread (void *) begin > > pfnTestFunc = GetProcAddress ("TestFunc"); > pfnTestFunc (); <<-- #3 > > iThreadsRunning--; > _endthread (); > > TestWorkerThread end > > ----- > A test DLL that contains the function TestFunc > ----- > > TestFunc (void) begin > > MessageBeep (0); > Sleep (5000); <<-- #4 > MessageBeep (0); > DDESend ("Topic", "Item", "Data"); <-- #5 > > return 0; > > TestFunc end > > This is what happens: During WM_CREATE a new thread gets called and the > iThreadsRunning is incremented by one. The new thread is running. The test > tread we'll call TestWorkerThread executes a DLL function called TestFunc. > TestFunc beeps once before a timer delay of 5 seconds and then beeps again > after. Execution control is returned back to TestWorkerThread which > decrements iThreadsRunning and terminates the thread. > > In normal conditions, this piece of code will work wonderfully. But, it > doesn't work right when the program terminates. When the WM_DESTROY is > recieved, the poll at the mark #1 is infinite, thus #2 is never reached. > In fact, you could say that the TestWorkerThread never returned or never is > given processing time during the point it is still in the DLL's "Sleep" (#4). > > What's the twist? The twist is that if you replace the code at #4 with "Sleep > (5000)", the thread will be active as opposed to implicitly being suspended. > That means #1 will stop looping after 5 seconds and actually get to #2. > > Does this means that Win95/98 does not handle threads correctly upon > termination? Is my understanding faltered? Anyways, I'm not sure about > running this in WinNT although I believe in WinNT there shouldn't be any > problems with multithreading. > > I've been working on this problem for a week and yet still no solutions. I > need to know how to do close up threads properly, even prematurely, real bad. > I'm looking forward for your replies! Thanks. =============================================== Subject: s-records Date: 11 Nov 1998 19:10:46 From: HH HOw would i encode a motorola s-record taking a user's input in decimal? i know the s-record format and i know i have to convert the decimal to a hex number and then sort that. but i am stuck on how to implement the conversion from hex to s-record in raw assembly code. any help would be appreciated! thanks in advance! =============================================== Subject: Binary resource Date: 11 Nov 1998 22:33:59 From: Tao Hi , i'd like to include binary resource in my project ; for instance , an executable file that could be "extracted" by the prog itself ! Could you help me ? Tao. =============================================== Subject: Binary resource Date: 13 Nov 1998 02:10:46 From: kill3xx i'd like to include binary resource in my project ; for instance , an executable file that could be "extracted" by the prog itself ! hi, u can add ur binary in the resources of ur prj and then retrive it using findresource,loadresource,lockresourse api.. in myres.rc: #define IDB_EXEBIN 200 #define MYBINARY 210 IDB_EXEBIN PEHEADER DISCARDABLE "my.bin" in myprj.asm: IDB_EXEBIN EQU 200 MYBINARY EQU 210 ..... call FindResource, hInstance, IDB_EXEBIN, MYBINARY call LoadResource, hInstance, eax call LockResource, eax mov lpMyBinary,eax note : it's no longer necessary to unlock locked resources in a win32 enviroment regards, kill3xx =============================================== Subject: Info about IDE's Date: 13 Nov 1998 02:03:33 From: Linuxjr Just a quick question is there any info out there to write a small and simple ide in assembler. I was thinking of maybe to try to get one working for Java since I am taking a course in that and started to realize there are not that many Java IDE's out there except like Symatec, Microsoft J++ and theres Kawa out there but I just like to try to write one for myself and wonder if there is an example or maybe some pointers out there to know how to tackle it. Any help will be appreciated. Linuxjr =============================================== Subject: Info about IDE's Date: 16 Nov 1998 09:37:29 From: hutch Speedy, I am away from home at the moment so I don't have any reference material but if you chase up Riched20 functionality, you can get some reasonably good performance in a small package if you can be bothered to learn the API calls for it. Multi level undo, large file sizes etc... Best data is in VC6 which is a pig to work out of but the data is there. hutch =============================================== Subject: palettes. Date: 14 Nov 1998 12:52:55 From: aubrey hi, could someone give me an example of creating/realizing a palette please? Thanks. =============================================== Subject: Tab Control Date: 16 Nov 1998 01:32:23 From: Chris Hobbs At first I had a problem even creating the child window of a tab control box. Then, after some experimentation I was able to create the tab control. The problem that I am now having is when I try to insert an item. Since I can't find the macros that would be in commctrl.h I decided to just use the macro's definition and go from there. The definition is as follows: #define TabCtrl_InsertItem(hwnd, iItem, pitem) \ (int)SendMessage((hwnd), TCM_INSERTITEM, (WPARAM)(int)iItem, (LPARAM)(const TC_ITEM FAR*)(pitem)) I then use this bit of code which gives me a general protection fault in commctrl.dll: invoke SendMessage,hTab,TCM_INSERTITEM,0,ADDR item If anybody out there has successfully created tab controls I would appreciate it if you could give me a hand on this. THANX!! Chris Hobbs =============================================== Subject: Best PE format doc? Date: 16 Nov 1998 13:41:15 From: TomCat/Abaddon 1. Which is the best PE binary format doc? 2. Does the final section need to be padded, or not? TomCat/Abaddon =============================================== Subject: Best PE format doc? Date: 17 Nov 1998 14:47:19 From: h- ::1. the one on wotsit is the best i think. :I have this one. PE.TXT v1.7 by B. Luevelsmeyer ::2. align the last section. :I don't understand this answer. Ok it must be aligned, but :what about zero-padding at the end? :(i think it must be...) all the answer is in pe.txt. =============================================== Subject: Best PE format doc? Date: 21 Nov 1998 02:22:21 From: virogen ::::1. Which is the best PE binary format doc? Best info is available on MSDN probably. However I have the 'original' documentation on my page at virogen.cjb.net. It's fairly complete and has served all my purposes. :::2. Does the final section need to be padded, or not? The final section's virtual size does not need to be aligned with the object alignment, however the physical size does need to be aligned on the file alignment. So it's a good idea to pad up to the next alignment boundary. You might be able to get away with not doing this under win95/98, but winNT is much more picky. latez virogen =============================================== Subject: Print Preview Date: 17 Nov 1998 15:03:50 From: Ewayne Is there any way to do a call to some function or program to do a print preview? Thanks, Ewayne =============================================== Subject: reg Date: 18 Nov 1998 18:42:40 From: Darklighter Hi How can I see what's in the registers of another process? =============================================== Subject: How to create an address from a param. Date: 20 Nov 1998 19:20:58 From: Ewayne At my program startup I'm reading in an ini file to setup some variables. In my ini file I have param names that precede each line item of information, the param names have the same names as there corresponding variable names in my program. Is there a way to create an address from the param name that will point to the variable name in my program. Right now I'm using a series of compares to load the info, but I'm sure there must be a way to create the address. Thanks, Ewayne =============================================== Subject: Help with printf Date: 20 Nov 1998 19:48:30 From: Cynical_Pinnacle I am trying to use printf from a 32 bit console mode program. Here is the code .386 .model flat, stdcall include win.inc include advapi32.inc include stdio.inc includelib advapi32.lib includelib kernel32.lib includelib libc.lib .data MyString db "Hello World",0 .code main: INVOKE printf, ADDR MyString INVOKE ExitProcess, 0 end main I am using the masm32 package and building in the following way. ml /c /coff /Cp print.asm link /subsystem:console /entry:main print.obj When I run the program it traps with an access violation in low memory. I know I am getting burned by VARARG but I can't figure out why. I have tried innumerable variations. Also when the program links the executable is 24K!!!! Does anyone know why this is happening. Thanks. Cynical Pinnacle =============================================== Subject: Help with printf Date: 21 Nov 1998 00:44:40 From: Iczelion I have several suggestions. First, you should not link your asm program with C library, it bloats up your executable to the point that it defeats the purpose s of assembly language: speed and size. Second, you should be aware that C functions use C calling sequence which pushes parameters from right to left and the caller is responsible for balancing the stack after the call. You specify the default calling convention as stdcall and you don't change the calling convention of printf to C. After the call, you should clean up the stack by: add esp,4 Since you push the address of MyString on the stack. Third, you'd be better off using Win32 API functions, your program will be smaller since the functions reside in various system dlls. =============================================== Subject: Windows assembler without Win32 APIs Date: 21 Nov 1998 02:28:57 From: virogen ::Anyone try this before? Well nobody said you HAVE to use APIs, but it'd be silly not to. Actually it'd be difficult to do much of anything without using any APIs. I don't even think PE executables with an empty import table will load under winNT, tho i might be wrong. latez virogen =============================================== Subject: How do you change the default TABSTOPS Date: 23 Nov 1998 04:37:50 From: Ewayne I'm trying to change the default tabstops in my edit control using: INVOKE SendMessage, hREdit, EM_SETTABSTOPS, 1, TS The return is zero which means it did not process. I don't need to set up an array for variable length stops. Thanks, Ewayne =============================================== Subject: Has anyone set TABSTOPS in a rich edit c Date: 25 Nov 1998 04:22:37 From: Ewayne I'm trying to change the tabstops in my rich edit control, first I tried using: INVOKE SendMessage, hREdit, EM_SETTABSTOPS, 1, TS But I received a '0' return, because I don't think it can be used in a rich edit control. Then I tried using: INVOKE SendMessage, hREdit, EM_SETPARAFORMAT, 0, offset pf I still received a '0' return and it doesn't matter which mask are set. The PARAFORMAT structure looks ok. Any ideas will be appreciated. Thinks, Ewayne =============================================== Subject: DirectDraw Demos - preliminary page Date: 24 Nov 1998 12:39:17 From: Mike Bibby Apologies - the server crashed. It's up and running now with a preliminary page featuring some Direct Draw demos in MASM and TASM. http://www.web-site.co.uk/tangent/arran/mike.html cheers, Mike =============================================== Subject: WARC4 version 1 available Date: 25 Nov 1998 21:06:04 From: Ghiribizzo http://www.chocbar.demon.co.uk/ghiribizzo/warc4.zip =============================================== Subject: Enable CTEXT disabled in Dlg box Date: 25 Nov 1998 23:08:48 From: Dave I have set up a dialog box with a GROUPBOX for 2 options -- Automatic and Manual using Radiobuttons. I also have a CTEXT line for Timer Delay which I have disabled. If the user clicks the Automatic radiobutton, I would like the Timer Delay text to go to the enabled state, however, 'Programming Windows 95' seems to only explain how to enable and disable a menu item, but no clear explanation on how to enable an individual dialog box text. Can anyone please advise if it is possible and if so, how to do it. Thanx for the tremendous help I have received using this bulletinboard and the knowledgable programmers. Dave =============================================== Subject: Enable CTEXT disabled in Dlg box Date: 26 Nov 1998 09:53:26 From: hutch Dave, Give the following API a try. What you will have to do is get the handle to the control that you wish to enable or disable with a call to GetDlgItem() and then use the handle with the following. EnableWindow( HWND hWnd, // handle to window BOOL bEnable // flag for enabling or disabling input TRUE is enabled FALSE is disabled push hWnd push TRUE call EnableWindow mov rval, eax ; test return value Hope it works OK, hutch =============================================== Subject: Enable CTEXT disabled in Dlg box Date: 26 Nov 1998 09:57:29 From: hutch Dave, I pushed the parameters the wrong way around, the following is correct. push TRUE ; or FALSE push hWnd ; the HANDLE call EnableWindow mov rval, eax ; test return value if necessary Hope it works OK, hutch =============================================== Subject: Enable CTEXT disabled in Dlg box Date: 30 Nov 1998 13:10:32 From: Dave Hutch, with Thanksgiving didn't have much to use your suggestion. I worked with it last night and it's working right now. Thanx for the help. Dave =============================================== Subject: Hooking the keyboard. Date: 26 Nov 1998 10:46:25 From: Transit Can someone explain to me how this is done, I was thinking of setwindowshookex... but... how are game trainers with ingame keys done? because the ones i've seen there have been no extra dll's... Please enlighten me. Thanks. =============================================== Subject: No Answer but... Date: 20 Dec 1998 08:16:32 From: JUICE I was wondering about something along similiar lines but only different(doh!). No actually, how could one go about mapping particular key sequences (shortcut-keys) to specific win system functions eg. Ctrl+M = maximize or Ctrl+Alt+N = Notepad etc. Any ideas? =============================================== Subject: Hooking the keyboard. Date: 11 Jan 1999 18:29:09 From: spockdude :Can someone explain to me how this is done, I was thinking of :setwindowshookex... but... how are game trainers with ingame keys :done? because the ones i've seen there have been no extra :dll's... :Please enlighten me. : :Thanks. You do use setwindowshookexa to get this done. Before doing so, there are certain parameters which must be initialised; push 00 push [DllHandle] push offset KeyboardProcedure push 02 call SetWindowsHookExA mov [HookHandle], dword ptr eax this is part of the code i use to install my hook procedure. The hook procedure is at offset HookProc, and what it does (or is supposed to do) is monitor the keys typed on the keyboard. This is where my problems start; After installing the hook, shouldnt the system call that hook procedure and execut it? this does not happen, as I have proved it. What i did was substitute the Keyboard procedure for a messagebox procedure. If the hook was actually installed, the messagebox should pop up. This doesn't happen? Could someone possibly explain to me why this happens? Here is part the code to the dll which contains the procedure: My main program (not included) calls this dll to the address InstallHook .Code Start: DllEntry proc instance:DWORD, reason:DWORD, reserved:DWORD mov eax,1 ret endp DllEntry InstallHook Proc uses ebx esi edi,Hwnd:DWORD mov dword ptr [DllHandle], eax push 00 push [DllHandle] push offset HookProc push eax push 02 call SetWindowsHookExA mov [HookHandle], dword ptr eax ret InstallHook endp ;**********START OF SUBSTITUTED KEYBOARD PROCEDURE************* HookProc Proc code:DWORD, wParam:DWORD, lParam:DWORD mov eax, wParam mov ebx, lParam mov edx, code mov dword ptr [virtual_code],eax mov dword ptr [scan_code],ebx mov dword ptr [hk_code],edx push 0 push offset Caption push offset Content push 0 call MessageBoxA ret HookProc endp End Start end I need to know if this hookprocedure is correct or not. =============================================== Subject: Iczelion WinSock!!! Date: 27 Nov 1998 07:16:57 From: Saqquara Nice job Iczelion on the HTTP15 project. I was wondering if anyone would ever try WinSock in ASM. I guess do you or anyone reading this message know of more examples? Also is there a port for TASM? Not that it looks EXTREME difficult to port, but I figure if it may exsist I'd save the work. I am looking to throw together a server browser for Half-Life. The servers specs were given out in the mini-SDK so I figure it's a skip from there. So any additional examples or TASM stuff too, would help a ton. -Saqquara- =============================================== Subject: 16 to 32 Date: 27 Nov 1998 10:43:27 From: Ulycz I gotta question. I've been learning 16 bit assembly just to get my feet wet. Now I want to move on to 32 bit. Problem is that when I compile my 32 bit asm module into a OBJ file, I can't resolve the external linkage when I add it to a 32 bit program like C+ Builder. extern "C" {something or other} just doesn't work any more. Works just fine in any 16 bit windows's program but not with 32 bit. Anybody know the solution? Thanks Ulycz tpylant@internetpro.net =============================================== Subject: #win32asm IRC @Home Date: 28 Nov 1998 01:38:57 From: Saqquara Alright everyone, I setup a permanent #win32asm IRC server on my box. Lets start getting together and hang out there. You can get on it via a IRC client or via the Web interface: c71114-a.potlnd1.or.home.com (for IRC clients: 6667) or http://c71114-a.potlnd1.or.home.com/ As you might guess, it's going to be dead for a while, until others start hanging out there. So you regulars feel free to jump into idle. I'll be setting up a domain for it in the next days along with updating the Web interface and all sortsa stuff. I was thinking about putting a page up, but found there are enough of those, so I wanted to provide something else that's cool and the IRC server is that thing. Enjoy! Any problems/suggestions/questions direct em at me at: saqquara@home.com ... Saqquara =============================================== Subject: #win32asm IRC @Home Date: 30 Nov 1998 16:46:05 From: Ghiribizzo Well, I like the option of using #win32asm via web. But can't you point it to a standard #Efnet server as that's the one everyone uses anyway. =============================================== Subject: How do I launch a file in its associated Date: 29 Nov 1998 17:01:10 From: Ewayne I have set several file types to associate with my edit program. When I dblclick on a file mame in file manager it loads my program, but I can't find a way to get the filename during the startup of my program. 1. GetCurrentDirectory - Doesn't return the file name. 2. GetModuleFileName - Just returns my executable path. 3. I know windows knows what the filename is, all I have to do is find it so I can display it when my program is launched from a associated file type. Thanks, Ewayne =============================================== Subject: Enter Date: 30 Nov 1998 14:55:08 From: Andox Hi if i have a Editbox (it's focus) and i want that text in the editbox then a user presses Enter (if the edixbox have the focus) the EN_CHANGE does not react on Enter and the WM_KEYUP (down) does only work if the Main window have the focus. Thanks =============================================== Subject: Enter Date: 1 Dec 1998 10:03:11 From: hutch This is MASM but you can convert it to TASM with no problems. You need to write a subclass function for it and set the address of the proc with, invoke SetWindowLong,hEdit1,GWL_WNDPROC,Ed1Proc mov lpfnEd1Proc, eax Ed2Proc proc hCtl :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD ; ----------------------------- ; Process control messages here ; ----------------------------- .if uMsg == WM_CHAR .if wParam >= "A" .if wParam <= "Z" add wParam, 32 .endif .endif .endif invoke CallWindowProc,lpfnEd2Proc,hCtl,uMsg,wParam,lParam ret Ed2Proc endp =============================================== Subject: Win32 assembly with TASM 5.0r Date: 2 Dec 1998 22:58:04 From: Sami Hi! I'm beginner in assembly programming. I Have always thought that programs written in assembly are small. But it seems thats not the case in Win32. Smallest win32 programs I could do is 4096 bytes long and is doesn't even do anything yet. Then I write few more lines and the EXE is suddenly 8192 bytes and so on. EXE seems to increase it's size always with 4096 bytes. Does anyone know is this a feature or am I doing something wrong? Thanks, Sami =============================================== Subject: Win32 assembly with TASM 5.0r Date: 5 Dec 1998 22:04:59 From: virogen TASM unfortunatly doesn't generate the most compact PEs. I wrote up a little utility that will decrease the size of your TASM executables. See VGAlign at http://virogen.cjb.net. latez vg =============================================== Subject: Win32 assembly with TASM 5.0r Date: 6 Dec 1998 22:53:35 From: Ghiribizzo The size of 4096 bytes is normal for TASM. Remember that your HDD cluster size is probably bigger than 4k anyway so there is no real space gain. Making the exe smaller can impact loading speed. You're probably better leaving it at 4k. I think MASM creates smaller files. =============================================== Subject: Win32 assembly with TASM 5.0r Date: 2 Dec 1998 23:10:02 From: hutch Sami, MASM pops a working window at 2.5k and a template with a menu & icon at 5120 bytes so there may be some difference in the basic size of the assembled code. I would not worry too much while you are learning how to use TASM as there are a lot of very good TASM programmers around who have posted a lot of very good code to use as examples. With some practice, you will learn the options of TASM which should give you more control over the assembled size. It is worth having a look at Iczelion's MASM example code as it will help get you up to speed and there is no problem getting MASM for free so you can have a look at it without it costing you anything. hutch =============================================== Subject: invoke RegQueryValueEx Date: 4 Dec 1998 07:46:16 From: Maverick I have some problems with the API RegQueryValueEx in Masm...Can you help me please ???? thanks =============================================== Subject: invoke RegQueryValueEx Date: 4 Dec 1998 09:36:44 From: hutch Maverick, I try not to do much with the windows registry but a quick look at win32.hlp says it should be a straight forward function call where you can test the return value to see what is going on. Could you post a bit more data about what you are doing with the call. hutch =============================================== Subject: invoke RegQueryValueEx Date: 13 Dec 1998 08:11:27 From: Maverick Well...I must change two values in the Reg but my code seems to not work...probably because I make an error with second and sixth parameter. I looking for an example for this function or more information....SDK is not very clear with this function.... Thanks =============================================== Subject: Automatic File Saving in Win32 Date: 5 Dec 1998 16:23:33 From: Vivek Hi! I am 20 yrs old and am doing graduation in computers. I am doing my final year project - To monitor the STATUS of an UPS and act accordingly. What i am trying to do is that i want to SAVE & CLOSE each and every open application and then shut down the OS. For shutting down the OS , Iczelion helped me out , for which i am really grateful to him. He advised me tackkle the problem by calling different API calls. But since I am not Iczelion, i can't think a way out. Can anybody please help me out. Well the point is that there maybe appications running in memory also, how do i check them, some windows which may be minimized, how to tackle them? =============================================== Subject: Automatic File Saving in Win32 Date: 5 Dec 1998 22:08:57 From: virogen lordlucifer.home.ml.org ---------- To shut down windows use the ExitWindowsEx API. This API will send appropriate messages to all running applications, notifying them and then telling them to shut down. You can specify the EWX_FORCE flag and applications will be forced to shut down and not display any such "Save changes" prompts. Documentation of this API is in MSDN of course, and the only other thing you need to consider is that if you are going to do a shutdown type other than EWX_LOGOFF under WinNT then you must get the shutdown token privledge for your app; this too is documented in MSDN and some sample code is even provided. latez virogen =============================================== Subject: nasm + alink Date: 9 Dec 1998 22:32:09 From: rlai : can someone please show me how to make : this hello world messagebox program : using nasm and alink? aqualung, Here is a simple "Hello World" program. Follow these steps to assemble and link. 1. Assemble with "nasm -fwin32 hworld.asm" 2. Link with "alink -oPE hworld win32.lib -entry main If you have further problems, just post them and I will try and answer them if I can. Hope this helps. cheers, ray ------------------------------------------------------------------------------- extern MessageBoxA segment .text global main main: push dword 0 push AppTitle push HWString push dword 0 call MessageBoxA ret section .data AppTitle: db 'Hello World.',0 HWString: db 'Hello, world',13,10,0 =============================================== Subject: float-ascii routines? Date: 9 Dec 1998 23:21:02 From: Ghiribizzo Has anyone written float->ascii routines? I saw the ones in the UCR standard library, but thought that it would be easier to just write my own. At the moment I'm writing a single precision (in mem) to ASCII as I thought it would be simpler to do this first. However, I've run into difficulty as I don't think I understand scientific binary. If you can help, email me at ghiribizzo@geocities.com I can decode to scientific binary, but am not sure how to convert to scientific decimal. 178.125 :) ~~ Ghiribizzo =============================================== Subject: TASM 5 Manual(s) Date: 10 Dec 1998 18:22:06 From: CisnA Hi, Does anyone know where I can get the TASM 5 manuals? (heh.. the TASM 4 help file leaves much to be desired) thanks, CisnA =============================================== Subject: Visual C++ for Windows CE wanted Date: 10 Dec 1998 23:25:25 From: Ghiribizzo Does anyone here have Visual C++ for Windows CE or another compiler for CE (SH3)? I need a compiler for palmtops (SH3 chip). If you have this, or can get hold of it. Please email me. [sorry for the warez request] ~~ Ghiribizzo =============================================== Subject: Capture Keystrokes Date: 12 Dec 1998 02:43:10 From: Infi QUESTION: How to capture Keystrokes or Mouse clicks anywhere in Windows? WIN32 API: The Win32 API says that "Hot-Key Controls" and the mouse and keyboard hooks (i.e. WH_MOUSE and WH_KEYBOARD used with SetWindowsHookEx) are application and/or thread specific. OTHER: It is obviously possible. Just look at all the windows macro utilities availiable. Does anyone actually know how they do it? Infinigen occthy@hotmail.com =============================================== Subject: Capture Keystrokes Date: 17 Dec 1998 21:38:31 From: rlai Hi Infinigen, : WIN32 API: The Win32 API says that "Hot-Key Controls" and the : mouse and keyboard hooks (i.e. WH_MOUSE and WH_KEYBOARD : used with SetWindowsHookEx) are application and/or thread specific. There are also global hooks available. Have a look at these: WH_JOURNALRECORD, WH_JOURNALPLAYBACK and WH_SYSMSGFILTER. There are also the WH_KEYBOARD_LL and WH_MOUSE_LL hooks but these are only available on NT systems. regards ray =============================================== Subject: pdf crack Date: 12 Dec 1998 13:26:41 From: Ghiribizzo :I was at Ghiribizzo's Home Page and his links to crack pdf files :aren't there anymore... know where I can get them? Most should still be there. Try uppercasing the filename: instead of: http://www.chocbar.demon.co.uk/ghiribizzo/ghiric10.pdf try: http://www.chocbar.demon.co.uk/ghiribizzo/GHIRIC10.PDF BTW, I intend to delete most of my tutorials sometime soon (and not post them again) so get what you want now) I retired from cracking a while ago and it's time to put it behind me. ~~ Ghiribizzo =============================================== Subject: Testing serial port Date: 13 Dec 1998 01:14:18 From: Dave Can anyone advise on writing code to test if a serial port is connected or is in use by another device? I am writing a database and machine control pgm which is intended to control up to 4 machines simultaneously. I am using microcontrollers and I have noted that Microchip's programmer displays 2 types of error messages when selecting the COM port - one msg if the port is connected to another device and another if the RS-232 cable is disconnected or power is not applied to the programmer. Any help would be greatly appreciated. Thanx. =============================================== Subject: Testing serial port Date: 13 Dec 1998 06:59:56 From: hutch Dave, I have just had to do a test on a parallel port using the following DOS code from WIN32. It tests if the printer is switched on. mov ah, 02h ; mov dx, 0 ; lpt1 int 17h mov pStatus, ah It gives either, ' ON is 144 decimal ' OFF is 48 decimal This works OK, may not work on later OS versions. I would be tempted to try DOS interrupt 14h and see if you can return value from them, there are 6 functions available. hutch =============================================== Subject: Testing serial port Date: 14 Dec 1998 01:24:10 From: Dave Hutch, thanx for the prompt response. What you discussed I recall from writing the DOS pgm to control one machine with one computer. Since all the advice I've seen says avoid the DOS interrupts, how about the function: call ClearCommError, hComm, OFFSET dwErrorMask, OFFSET comstat where comstat is a structure. Would this work? Or possibly the functions GetCommMask, SetCommMask, and WaitCommEvent? Thanx for any help. Dave =============================================== Subject: Testing serial port Date: 14 Dec 1998 06:23:14 From: hutch Dave, It seems that the DOS interrupts work in win 95, maybe win 98 and not in win NT4,(access violation). A quick look at the APIs you mentioned says use the CreateFile() function to get a handle to a device (com1, lpt1 etc..) and give the functions a try. Generally, hardware access is very poorly supported in WIN32 so you have to try and pick your way through badly dopcumented APIs. If you think that these functions will give you the control that you need with another computer, it is worth a try but I would be testing every return value on the way to make sure they are working. hutch =============================================== Subject: Testing serial port Date: 14 Dec 1998 22:54:09 From: Dave Hutch, are you saying I can directly use the software interrupt 14H without having to switch to 16-bit coding. If that is OK, naturally it would be easier (I'm already familiar with DOS ASM) and it would simply be testing bit 7 of the AH register for a time out? By the way, the functions and structures I quoted previously came from 'Communications Programming for Windows 95' by Mirho and Terrisse. Dave =============================================== Subject: resource editor/compiler..?? Date: 13 Dec 1998 02:13:24 From: Ghiribizzo :I was just curious to know whether there is any new resource :editors or compilers out there that are available, cos the ones I :have seem slighty dated, being 'Borland Resource Workshop v4.5', :and 'Symantec Resource studio v1.0'... ;-) There's apparently a very good one by Microsoft (i think part of the visual studio suite). I haven't used it. =============================================== Subject: Visual C++ for Windows CE wanted Date: 14 Dec 1998 13:20:15 From: Ghiribizzo You can get the VC plug-ins from MS, but you need to write to them (and presumably own VC5 or VC6). Looks like I just missed the boat on a free copy too: http://www.acm.org/windowsce/ I'll see if I can get hold of one of these plugins. I'm wondering if I can put together my own compiler. I wonder if I can do it by using something like TASM, using macros to generate the opcodes and creating an import32.lib for the SH3 DLLs? Well, I have no experience at all with this sort of thing, but maybe it's a possibility. If anyone manages to get hold of the plug-ins, (or VC++ for CE) please email me. VC++ 5 plug in: http://www.microsoft.com/windowsce/hpc/developer/vccedata.asp VC++ 6 plug in: http://www.microsoft.com/windowsce/hpc/developer/wcetkvc.asp Some links to other dev kits: http://www.roadcoders.com/showce.phtml?cat=sdk Freeware SH3 compiler (not for CE): http://www.halsp.hitachi.com/tech_prod/software_tools/gnu96q3.htm# q3tools =============================================== Subject: How do you share a variable between mult Date: 15 Dec 1998 15:38:48 From: Ewayne How do you share a variable between multiple instances of a program? Thanks, Ewayne =============================================== Subject: How do you share a variable between Date: 17 Dec 1998 01:57:58 From: rlai Make your variable global and static. Use semaphores to synchronise reads and writes to it. ray =============================================== Subject: Problem Make File Date: 16 Dec 1998 13:36:44 From: Mike Warner The very nice skeleton.zip package-- The built executable runs fine under NT4/SP4. I modified the make file for my machine. It is listed below. When I run it, it compiles everything fine, but blows up on the linkage. I get the error message also given below. It appears to me the make doesn't recognize USER32.DLL as a valid library. I thought perhaps the problem was that the "/SUBSYSTEM:WINDOWS,4.0" line was incorrect for the operating system, so I changed it to "/SUBSYSTEM:WINDOWS" with no effect. Got a clue? Thanks. Mike *****BEGIN ERROR MESSAGE E:\ASM\MASM611\BIN\ML /c /coff WinMain.asm Assembling: WinMain.asm [etc.] Microsoft (R) 32-Bit Incremental Linker Version 5.00.7022 Copyright (C) Microsoft Corp 1992-1997. All rights reserved. /MACHINE:i386 /SUBSYSTEM:WINDOWS /ENTRY:Start /OUT:Skeleton.exe WinMain.obj WndProc.obj Msg.obj Misc.obj About.obj StatBar.obj ToolBar.obj CmdFile.obj Resource.res C:\WINNT\SYSTEM32\USER32.DLL C:\WINNT\SYSTEM32\KERNEL32.DLL C:\WINNT\SYSTEM32\GDI32.DLL C:\WINNT\SYSTEM32\COMDLG32.DLL C:\WINNT\SYSTEM32\COMCTL32.DLL C:\WINNT\SYSTEM32\USER32.DLL : fatal error LNK1136: invalid or corrupt file *****END ERROR MESSAGE *****BEGIN MAKEFILE PROJECT = Skeleton OBJ_CORE = WinMain.obj WndProc.obj Msg.obj Misc.obj About.obj OBJ_MORE = StatBar.obj ToolBar.obj CmdFile.obj RESOURCES = Icon.ico ALL: $(PROJECT).exe $(PROJECT).hlp # Definition of assembler and linker options **************************** !IFDEF debug AssemblerOptions = /c /coff /Zi LinkerOptions = /DEBUGTYPE:COFF /DEBUG:MAPPED,FULL !ELSE AssemblerOptions = /c /coff LinkerOptions = !ENDIF # Inference rule for updating object files ****************************** .asm.obj: E:\ASM\MASM611\BIN\ML $(AssemblerOptions) $< #/SUBSYSTEM:WINDOWS,4.0 # Build rule for executable ********************************************* $(PROJECT).exe: $(OBJ_CORE) $(OBJ_MORE) Resource.res E:\DEVSTUDIO\VC\BIN\LINK $(LinkerOptions) @< I think I see the error of my ways. DLLs (duh) aren't linkage libraries. Therefore, the files I want to link-to are not in c:\winnt\system32; they are in e:devstudio\vc\lib, where I have VC 5 installed. Sorry to suck up bandwidth with this sophomoric brain-fart. Mike =============================================== Subject: Creating files from a resource. Date: 18 Dec 1998 01:26:08 From: Minstrel Hello everyone.. Could someone please tell me how I can write to disk the data from a resource? eg: I have an executable defined in the resource file that I want to extract and run at runtime... How would I go about it? Thanks a lot for any help. =============================================== Subject: Creating files from a resource. Date: 20 Dec 1998 09:56:07 From: Minstrel :You must call FindResource to search for the custom resource you :defined. And then call LoadResource and LockResource. You'll get a :pointer to the raw resource data. :Iczelion Yep... I tried that, it jsut kept generating 0 byte files, i used the pointer returned from lockresource as the parameter to writefile.. :( =============================================== Subject: Microcontroller control Date: 19 Dec 1998 01:50:20 From: Dave I am sending a signal out to a Microchip microcontroller on Com2 at 19.2kbps. Since the computer pgm must control up to 4 machines, the microcontroller on machine #1 receives the signal 01H and if detected the microcontroller for machine #1 should return the value 10H. The code is as follows: BytesWritten DWORD ? BytesRead DWORD ? hComm2 HANDLE ? overlapped OVERLAPPED Comm2File DB "Com2", 0 Trigger_1 DB 01H Machine1 DB ? call CreateFile, OFFSET Comm2File, GENERIC_READWRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL mov hComm2, eax call WriteFile, hComm2, OFFSET Trigger_1, OFFSET BytesWritten, OFFSET overlapped mov ecx, 00FFFFFFH ;create a delay dec ecx jnz (to the previous line) call ReadFile, Comm2, OFFSET Machine1, 1, OFFSET BytesRead, OFFSET overlapped .IF Machine != 10H display error msg Using TD32 the pgm works fine until the actual call ReadFile line and then the pgm hangs up. Can anyone give advice as to what I'm doing wrong. Many thanx. Dave =============================================== Subject: Delete .lnk file... Date: 19 Dec 1998 08:48:46 From: Maverick Hi, Do you know if DeleteFile API function can delete the .lnk file on desktop or in programs menu ??? I've tried but it seem not work.... Thanks to all.... Maverick =============================================== Subject: FindFirstFile Date: 19 Dec 1998 12:56:16 From: "L.I.H." Could someone explain how to make this work. Including how to set up the WIN32_FIND_DATA structure. Should the fields in this structure be DW or DD ? How do i get the found filename/foldername from cFileName ? I just can't get it to work :( Thanks =============================================== Subject: FindFirstFile Date: 20 Dec 1998 05:22:00 From: Iczelion FILETIME STRUCT DWORD dwLowDateTime DWORD ? dwHighDateTime DWORD ? FILETIME ENDS MAX_PATH equ 260 WIN32_FIND_DATA STRUCT DWORD dwFileAttributes DWORD ? ftCreationTime FILETIME <> ftLastAccessTime FILETIME <> ftLastWriteTime FILETIME <> nFileSizeHigh DWORD ? nFileSizeLow DWORD ? dwReserved0 DWORD ? dwReserved1 DWORD ? cFileName BYTE MAX_PATH dup(?) cAlternate BYTE 14 dup(?) WIN32_FIND_DATA ENDS =============================================== Subject: TAB ----&---- LISTVIEW ETC. Date: 20 Dec 1998 03:13:03 From: JUICE :Anyone have any answer's to the above ui components, if so please :send them my way. Cannot get them to work :( worx - too easy =============================================== Subject: Windows Assembly Language and Systems Pr Date: 23 Dec 1998 01:32:52 From: Rundus I have zipped and uploaded the compansion code disk files for Windows Assembly Language and Systems Programming by Barry KAULER. Its in the References section at rundus.cjb.net I do not think Barry will mind too much as it might generate some more sales of his book. cheers Rundus =============================================== Subject: EnumWindows() Problem Date: 23 Dec 1998 17:45:47 From: Vivek Can anybody please tell me the proper way of writing Enumwindows and it's CALLBACK function using an example in Visual C++ 5.0 I have tried very hard to make a enumwindows callback function but it won't compile due to some unknown syntax errors. Can anybdy please give me small example of writing ENUMWINDOWS() and using the CALLBACK function in Visual C++ . =============================================== Subject: NT undocumented (?!) structs Date: 24 Dec 1998 00:36:15 From: kill3xx Hi ALL, I'm spelunking how kernel32 and NTDLL works with threads and processes beyond the scenes.. looking at GetCurrentProccessID i find that fs:18 seems to point (like w9x) to a TIB structs.. but now the probz is to figure out what a TIB looks like under NT, but i'm not pietrek ;) so any hints/referances 'll very appreciated.. thx in advance , kill3xx =============================================== Subject: modem drivers Date: 24 Dec 1998 01:24:40 From: rlai Anyone have experience writing drivers for modems? =============================================== Subject: visual assembler + Date: 24 Dec 1998 13:45:40 From: zues Hello.. Does anyone know a visual assembler package ?? I found one on the web called visual A+ but it's 25% finished and it looks like there are no succesors ..... I like really good though. greetings =============================================== Subject: PE modifications Date: 25 Dec 1998 09:10:07 From: Tao Hi , i'm trying to add resources to an .exe ; but i don't understand how to fix the PE header ... Could you give me some tips ? Thanks a lot. Merry XMas , Tao. =============================================== Subject: SIMPLE serial communication Date: 28 Dec 1998 02:56:32 From: Dave Hope everyon had a nic Christmas and wishing all a Happy New Year. My problem deals with trying to communicate with a microcontroller using only TxD, RxD, and GND (control lines are jumpered together.) For machine #1 a test signal is sent out using WriteFile (01H) and a return signal using ReadFile is supposed to return 01H to acknowledge. Using ClearCommError and testing comstat.cbInQue I get getting there are no bytes to read. I've checked and doublechecked my microcontroller code and have also bypassed by test-in code to see what displays on the machine with my data-in routine - a 1 displays on the machine so I know WriteFile and the microcontroller are working OK. Any ideas on what I'm doing done would certainly be appreciated. Thanx. Dave. It has become so frustrating I am about to give up and I really don't want to do that - I won't let it beat me!!! =============================================== Subject: MASM 6.11 Date: 29 Dec 1998 01:35:11 From: Craftie Hey...I need MASM 6.11...The links on Iczelions site need updating, probably because of the server change...Where can I find a copy of MASM 6.11 as well as the patch to 6.13? Thanks --Craftie =============================================== Subject: MASM 6.11 Date: 30 Dec 1998 23:47:58 From: sofbug MASM 6.11 as well as the patch to 6.13? Thanks get the windows 98ddk for the assembler. =============================================== Subject: Win32 flat memory model Date: 31 Dec 1998 17:20:31 From: GEnius I want to discuss about the Win32 memory model organization. I've chosen to talk about this subject, because i've not found any information about this. So after read some Intel source the m$ ddk and some windows reverse, i'll able to try a first conclusion. Win32 at ring 3 uses the flat memory model, whereas at ring 0 it uses normal memory addressing with the paging enabled. But before i continue, i want to remind the protected mode-addressing model: In protected each segment is defined by the programmer, it can choose the base address, the size of the segment and other things such as privilege level. The structure that defines these attributes of a segment is called DESCRIPTOR. The descriptors are situated in two table the LDT (local descriptors table), GDT (global descriptors table). There is only one GDT and more LDT defined at execution time. The pointer of a LDT is in LDTR register and the pointer to GDT is in GDTR register. You can select a segment loading a SELECTOR in a segment register. The selector is a 16 bit data that indicate the descriptors table chose (LDT or GDT), an index to this table and the requestor's privilege level. Therefore you can address a memory location by the couple Selector/Offset (the offset can be 32 or 16 bits, in 32 bit environment is 32 otherwise is 16). When you modify a segment register with a new selector, the 80x86 read the descriptor information and makes a LINEAR ADDRESS before it accesses memory. The linear address is created by reading the segment base field of the descriptor and adding the offset. LDTR or GDTR---->|DESCRIPTORS TABLE| | | SELECTOR ----> | entry.Segment_Base_field + OFFSET = LINEAR ADDRESS Now if the paging is disabled the linear address are the same of the physical address. Therefore if the paging is enabled the linear address is different from the physical. In this case, the linear address is viewed from the 80x86 in this way: Linear address 32 bit: Bits 0..11 = OFFSET Bits 12..21 = PAGE Bits 22..31 = DIR Linear address = DIR:PAGE:OFFSET The paging in the 80x86 is implemented in this way, a page is generally of 4k, and there is a two level table of pages in which each entry specify the page frame address, protection and so on. In the Cr3 register there is the pointer to the 1 level page table (the dir table). The entries of the dir table points to a page table (the 2 level page). The physical addressed is created in this way: Linear address = DIR:PAGE:OFFSET CR3 ------>| PAGE DIRECTORY | | | DIR -----> | entry ---------| -> |PAGE TABLE| | | PAGE---------------------------->| entry.frame_address_field + OFFSET = PHYSICAL ADDRESS Note this scheme is valid only if the page is of 4k and the extending address is disabled. The FLAT addressing model is a simple model used to "bypass" the segmentation. A flat address model is created by assign two segments one for data and one for code with a Segment base of 0. So your OFFSET are just like linear address, in fact the Segment base is 0 and so the offset + 0 = linear address! There are several implementation of the flat model with more segments, with paging enabled or disabled and so on. Note that there is no way to disable segmentation only the paging can be enabled or disabled, the flat model don't disable the segmentation only "hide" it! For more information about this argument please read the Intel documents. And now the win32 implementation of the addressing modes of the Intel chips. At ring 3 Win32 use the flat addressing model, two main segment where created one for code and one for data, both with base address set to 0. Win32 use the paging so the linear address is different from the physical (each page is 4k). For the nature of the flat addressing model at ring 3 processes can see only the addresses mapped in their address space and nothing else! There aren't any win32 API (i expect) that allocate a GDT/LDT descriptors, but if know where a descriptor in GDT/LDT points, you can load the selector in a register segment and you can address this region of memory! As result of this flat addressing model implemented at ring 3 you are able to write in the code segment which is possible because the data and the code segment have the same base address and consequently the same address. Note that the 80x86 are not able to write in a code segment! Win32, logically, cannot use only the flat model; in fact, at ring 0 you may use the selectors. Each VM has an own LDT and use that for memory access. In the LDT, there are segments of 32 and 16 bits, this is due the fact that in Win9x you can execute the 16bit code. Naturally, also in ring 0 the paging is enabled so the physical address is a bit more complex to create. At ring 0 you can allocate a single page and generally is the "page" the unit allocation base. In fact some VMM service required a page number as argument, this page number is the combination of DIR:TABLE of the linear address. For example if you have a linear address, you can get the page number simply with shr linear_address,12 so the DIR:TABLE are shifted to right in the position of the offset. Finally, this is the linear address space organization of Win9x (stolen from DDK): " The system divides the linear address space into four areas, called arenas, each of which is managed differently. The DOS arena spans linear addresses in the range MINDOSLADDR (00000000H) through MAXDOSLADDR (003fffffH), and is used for virtual machines (VMS). The DOS arena is itself divided into several areas. For more information about the DOS arena, see V86 Address Space Mapping and Allocation. The private arena spans linear addresses in the range MINPRIVATELADDR (00400000H) through MAXPRIVATELADDR (7fffffffH). This arena is used for code and data that is private to a Win32 process. The mapping of pages in this arena to physical storage depends on the current memory context, as does which pages are reserved. The shared arena spans linear addresses in the range MINSHAREDLADDR (80000000H) through MAXSHAREDLADDR (0bfffffffH). This arena is used for ring-3 shared code and data, such as 16-bit Windows applications and DLLs, DPMI memory, and 32-bit system DLLs. The mapping of pages in this arena does not depend on the current VM or memory context. The system arena spans linear addresses in the range MINSYSTEMLADDR (0c0000000H) through MAXSYSTEMLADDR (0bfffffffH). This arena is used for code and data for the VMM and virtual devices. The last four megabytes of the linear address space are permanently invalid and is not part of any arena. Because zero is a valid address, you should use an address in this permanently invalid region to denote an invalid pointer. To be extra safe, you can use the value 0xFFFE0000, which lies right in the middle of the invalid region. " This explanation there isn't very complete, but i hope that can be useful for every win32 coders! Any addition and/or correction are appreciated! :-) Merry Xmas, and Happy New Year! :) Excuse my BAD English :( ThanX Kill3xxx Iczelion =============================================== Subject: Progress-Bar in ASM code (Win32) Date: 2 Jan 1999 21:32:26 From: Marcello Hi, How do I realize a progress-bar in asm code with TASM 5.x ? Thanks! =============================================== Subject: Auto-Detection of Internet Connection ? Date: 6 Jan 1999 04:08:52 From: mml <-mml-@iname.com> I want to write a routine in my Program which is continuosly running in the background, such that if a user connects to internet, it detects it automatically and do some thing... How can this be done in Windows 95/98 ? regards MML =============================================== Subject: R/W memory locations..... help! Date: 7 Jan 1999 00:56:32 From: Mikula Can someone please write a simple memory writting program using assembly language? For Example.... I want to write a new instruction to this memory location how can I do it? xxxx:xxxxxxxx =============================================== Subject: R/W memory locations..... help! Date: 7 Jan 1999 18:56:27 From: Ghiribizzo I did something like this (trainer for mechwarrior). I loaded the target process and used writeprocessmemory. The sourcecode might still be on my site. The url is given on this board... somewhere. Sorry, I don't know the url myself :) But it's fairly easy to do. =============================================== Subject: One serious question. Emergency. Date: 8 Jan 1999 01:03:08 From: Learner I recently downloaded a freeware. After a few day testing, I really hate it. So I basically deleted it. But 2 days later when I was debugging. I typed Task in SoftIce then I was shocked, because the program I uninstalled still runs regardless the fact that I've entirely deleted it already... I then discovers that it is still doing something to my computer... Something really nasty... it seems to detect my internet connection then send some data via internet...... I'm not good enough to know what it sends...... Is there anyway to close that program using softice or anything else?? Either permanantly or periodically close it will be fine. =============================================== Subject: One serious question. Emergency. Date: 10 Jan 1999 02:54:11 From: Flavio All right, that question doesn't quite fit here, but I'm feeling kind-hearted tonight... ;) [snip] :I then :discovers that it is still doing something to my computer... :Something really nasty... it seems to detect my internet :connection then send some data via internet...... Hhhhmmm, Smells like that "back orifice" thing. (I'm just guessing here, mind you). :I'm not good enough to know what it sends...... :Is there anyway to close that program using softice or anything :else?? Either permanantly or periodically close it will be fine. Get regedit and have a look at: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\. (Those guys at MS sure like keys aplenty, don't they?) ;) Check the "run" key out. Mine, for instance, has "systray.exe" in it. Probably the evil piece of code placed a command there to load itself on every boot. Other than that, it could use the startup menu entry, but that would be too visible. I sincerely hope this solves the problem. =============================================== Subject: One serious question. Emergency. Date: 11 Jan 1999 15:14:30 From: "Noname.NoNet" . . . :Get regedit and have a look at: : :HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\. :(Those guys at MS sure like keys aplenty, don't they?) ;) :Check the "run" key out. Mine, for instance, has "systray.exe" in :it. Probably the evil piece of code placed a command there to :load itself on every boot. Other than that, it could use the :startup menu entry, but that would be too visible. : :I sincerely hope this solves the problem. Windows also parsers load&run sections on old win.ini & system.ini Windows registry also may or may not have "load" keys... use search. BW what prog was it?????. Just interesting =============================================== Subject: Cppbuilder and Tasm Date: 10 Jan 1999 07:12:12 From: xiong chuan Hi I can't link cpp program with asm program in cbuilder 3,I need help.thanks =============================================== Subject: Cppbuilder and Tasm Date: 10 Jan 1999 19:45:11 From: lucifer hmmm you could try this patch: http://www.inprise.com/devsupport/borlandcpp/patches/TASMPT.ZIP which will modify TD32.EXE and TASM32.EXE to support c++ Builder applications lucifer lord-lucifer@usa.net =============================================== Subject: Advice! Date: 10 Jan 1999 16:46:47 From: Kamel Hi every body, I'm sort of new to this whole thing. Most of my work experience is with high language programming (C/C++/Java). I previously did some work with DOS asm, but left it alone since. Given the gain in popularity of WIN32 asm programming, I though to ask advice about where to start. Specifically I'm looking for the following information: - A good start point with tutorial about asm programming (WIN32 ofcourse)? - Where do I get the necessary tools and what are they? - Any other information the responder might thing helpfull? Thanks all =============================================== Subject: Advice! Date: 11 Jan 1999 00:08:51 From: G iczelion.cjb.net is a good start for tools and tutorials. You need to get hold of a compiler masm or tasm. You need to get an API reference (should come with your C++ dev suite). That should be enough to get you started.. =============================================== Subject: Launching external programs. Date: 11 Jan 1999 04:00:00 From: Iczelion :How do I get my win32 asm prog to load and run another program. :For instance, i want to load and run pkunzip with command line :args. Or load and run another win32 exe like setup.exe :Can anyone help? Use ShellExecute or CreateProcess =============================================== Subject: VMM_PageModifyPermissions Date: 11 Jan 1999 12:29:54 From: Billy "Belcebú" Hi. I have a doubt with that service. I access it by using the VxDCall0. All seems to work good, but when requesting to change the mode of the memory zone where is the kernel, it returns me an error. I use Windows 98. That method works preety good in 95, as a friend told me. I need an answer. Thanx for yer time. Billy Belcebú. =============================================== Subject: passing data between the main proggie an Date: 11 Jan 1999 18:28:09 From: spockdude Can someone please explain to me how you can pass data to and from the main programm and the dll's which it calls? -spockdude- =============================================== Subject: Making Win32 Programs TSR Date: 11 Jan 1999 18:33:02 From: CrackerBhai Is there any way to make Win32 programs memory resident or a sort of TSR. I want the program to be loaded whenever windows is loaded, but don't want it to be placed in startup. I just want it to make it invisible and and make it stay in the memory.What API calls should i use to do so ? =============================================== Subject: Making Win32 Programs TSR Date: 11 Jan 1999 18:53:45 From: spockdude Yes, and it is called hooking. you use setwindowshookexa, unhookwindowshook, callnexthookex, etc. These are found in the winapi reference. =============================================== Subject: Making Win32 Programs TSR Date: 11 Jan 1999 23:16:33 From: Ghiribizzo Try finding Stone's notes on some pseudo-residency techniques. I think he wrote something on API hooking and I think messagehooks too... =============================================== Subject: Masm and debugging Date: 11 Jan 1999 08:30:11 From: Pusillus hi, I'm a newbie. Which commands I've to switch with ml.exe and link.exe for generate a debug information to load in softice? I've setted the /Zi in ML and /DEBUG in LINK but the debug information are stored in a .PDB file and in softice symbol loader can process only .SYM and .DBG files. tank's in advance =============================================== Subject: 2nd dialog box Date: 12 Jan 1999 00:05:43 From: Dave Hutch, thanx for the advice on using INT 14H on initializing the serial ports. It works fine. From there I am using IN AL,DX and OUT DX,AL. This also is now working fine (the pgm is not being designed for WinNT.) While the serial bytes are being sent and received to and from the microcontroller, I would like to have a dialog box display with no OK or CANCEL pushbuttons, and automatically disappear when the 1-4 machines have been tested for readiness by the pgm. Is there a simple way to do this? Thanx for the advice. Dave =============================================== Subject: wsprintfa declaration Date: 12 Jan 1999 14:58:32 From: pusillus hi, soyy for my stupid questions I need to declare wsprintfa in my windows.inc file for MASM the declaration in winuser.h is: WINUSERAPI int WINAPIV wsprintfA(LPSTR, LPCSTR, ...); I don't know how to declare in Win32asm the ... parameter I've tried with: wsprintf PROTO WINAPI :LPSTR, :LPCSTR, :UINT but the linker send this message: ---------- dialog.obj : error LNK2001: unresolved external symbol _wsprintf@12 dialog.exe : fatal error LNK1120: 1 unresolved externals ---------- please help me! thank's in advance =============================================== Subject: wsprintfa declaration Date: 12 Jan 1999 16:57:48 From: Dave :Note the 'A' after wsprintf. This indicates a Windows 95 function. :From my experience you need to use wsprintfA for the declaration in :your .INC file. Hope that helps you. Dave Forgot to mention that, in your .ASM file use call wsprintfA, (parameters). Good luck =============================================== Subject: listbox Date: 12 Jan 1999 18:19:03 From: anybody Does anyone know a tutorial how to use a listbox in asm. Or can someone show me ??? Thanks a lot for the efford =============================================== Subject: Win32 Tray Icon Date: 13 Jan 1999 09:54:26 From: Jimmy Hi, I need to create a tray icon in win95/98/nt when I start up, then remove it when my prog is finished. I found some c code that does it, but tracing it with TD32 is very hard as it's got all the c rubbish at the start, and the code is very cryptic. It uses Shell_NotifyIconA I can't find much info on this function. Any help would be greatfuly recieved....... Thanx BTW. Coding in TASM 5 to win32 exe =============================================== Subject: Win95 title bar Date: 13 Jan 1999 12:56:51 From: Clerihew I would like to know if anyone knows how to add icons to the title bar in windows 95? I'm refering to the area on the right side of the bar, by the clock? Thanks!) Clerihew =============================================== Subject: Win95 title bar / Tray ICONS Date: 13 Jan 1999 16:50:14 From: Jimmy Just worked out how to do it..... notdata dd 24 + 64 ; cbsize hWnd dd 0 ; hwnd dd 1029 ; uID dd 6 ; uFlags dd 700h ; callbackmessage hIcon dd 0 ; hIcon db 'Hello', 0 ; szTip(64) push L 32512 push L 0 call LoadIconA ; Load a default icon, or change ; to load from resource mov hIcon, eax push L offset notdata push L 0 ; 0 = ADD ; 1 = MODIFY (Animate yer icon) ; 2 = REMOVE call Shell_NotifyIconA =============================================== Subject: COMBO BOX Within a DIALOG BOX Date: 15 Jan 1999 04:11:23 From: Ewayne How do you load a COMBO BOX or LIST BOX that's within a DIALOG BOX? Thanks; Ewayne =============================================== Subject: Tree View Control Date: 15 Jan 1999 23:48:25 From: Radium Could someone pls post a tutorial on using a tree view control for browsing a hard drive to select directorys. An example in Tasm and Masm would be appropriate. Tks, Radium. =============================================== Subject: RegOpenKeyExA Date: 16 Jan 1999 21:39:08 From: MultiAGP Could someone post and/or email me an example on how to use RegOpenKeyExA (I'd prefer masm code). I've tried several times, but all I get is ERROR_INVALID_FUNCTION. (I've also tried the sample which was posted here but no go) I'd be very grateful if someone could help me out. Thanks. - MultiAGP =============================================== Subject: RegOpenKeyExA Date: 19 Jan 1999 04:42:45 From: lucifer I have an example program which uses the RegOpenKeyExA function. Find it at: http://www.fortunecity.com/skyscraper/corel/378/bg2a.zip the program is written for tasm, but you should have no problems understanding or using the code... lucifer lord-lucifer@usa.net =============================================== Subject: ComboBox on the toolbar Date: 18 Jan 1999 23:38:03 From: Dave Is anyone aware of some good examples on the Internet or in any good book on how to write the code for utilization of a combobox on the toolbar? I have Petzold's book but it is not of much value for TASM. Thanx Dave =============================================== Subject: Shell_notifyicon Date: 19 Jan 1999 07:37:08 From: Clerihew Hi again. Just want to know if anyone know how to make win32 callback an application when using tray icons. I know the you have to use the struc member uCallBackMessage, but how does you create the identifier of the proc, or do you have to use the WndProc of the Application?? Thanks in advance. =============================================== Subject: anti-sice Date: 19 Jan 1999 16:02:13 From: raza btw, i'm trying to do this in Windows not dos. :i'm trying to implement some anti-softice techniques. I did get :a copy of Assembly Language Master Class but the first two :examples only seem to work for dos programs. It was :also suggested to hook int 01 and implement your own interrupt :handler. However the book only describes how to hook int 21h :functions. I have not idea how to go about hooking int 01...any :advice or code samples? ------------------------------------------------------------------------------- From: MAK Subject: re: anti-sice Date: 1 Mar 1999 10:54:32 It's not that difficult!! See if you can get the source for the CIH virus, it uses interupt hooking for uptaining ring0 I think stone has an essay about it as well. Just hook both the int 1 and 3, and softice's breakpoints are out of buisness (both bpmb and bpx). It's pretty esay to detect if they are hooked, just enter SIW and use IDT and you will see that the Int´s are hooked. Normally in win98 they are refering to WMM. =============================================================================== From: Knotty Dread Subject: Visual Assembler Date: 29 Jan 1999 22:34:52 Hello fellow sentient beings... I wonder whether there are any intrested coders here that might want to help reviving the Visual Assembler project from HCU. We're in need of BC++builder coders, and of experienced ASM coders. Also every other help will be appreciated. Awaiting your respons, and maybe it'll be a good idea to go to the VisAsm messageboard, via Mammons' page... Knotty Dread =============================================================================== From: Craftie Subject: Warning! No stack! (???) Date: 30 Jan 1999 15:36:41 Greetings....I'm having a problem...OFten times when I assemble something it works, but when I link it saysf"WARNING! NO STACK!".......I'm using TASM, and am wondering what this means....Its an ASM keygen (My first ASM program really) and whene I run it it says than an error has occured and it shuts down---It displays the first logo and 'Enter your name:' before crashing.....To be honest I'm just ripping the keygen material and copying the 'enter your name' things from other keygens (and the code to read vaules from the keyboard)...One more thing---When retrieving a string from the keyboard, does it ALWAYS have to go to DX, or can you send it to lets say ESI??? (I need it in ESI for this keygen...) any help will be appreciated!!! ------------------------------------------------------------------------------- From: "John W." Subject: re: Warning! No stack! (???) Date: 23 Feb 1999 09:28:40 This depends on a lot of things. When I code a .com program this always happens and can be ignored because a .com program doesn't use a stack segment. (But then you should use something like exe2bin.exe to make it a .com program.) If it is a Windows program, perhaps: 1. You haven't declared your LOCAL variables. According to the MASM Programmer's guide (Sorry), "To use a local variable, you must save stack space for it at the start of the procedure." For example, in MASM, you declare LOCAL variables and save space for them, by declaring them as follows: LOCAL wc :WNDCLASSEX LOCAL msg :MSG ******* (etc.) The format of the LOCAL directive has the syntax LOCAL label [[[count]]] [[: datatype ]] 2. You haven't defined the model as .flat or declared the processor type, i.e. .386, .486, etc; or, 3. Perhaps TASM is just twitchy and feels naked unless you have some dummy .stack statement even when using the .flat memory model. Such a statement is not necessary in MASM. This is probably the case because if the program still works without being buggy, its just complaining in a way that MASM doesn't. I hope this helps. =============================================================================== From: hiroshimator Subject: MASM or TASM Date: 31 Jan 1999 20:46:35 Hi everyone, until now I only used ASM in DOS for small programs and thus not very often. I always used tasm, for interface and usage reasons (don't ask me why sometimes I have weird feelings ;) but now when wanting to program for windows in ASM, I wonder which assembler to actually use: MASM or TASM. Could anyone point out the biggest difference or the reason why I should use 1 of them for win32 programming, so I can give myself a good start? thank you very much, -H- ------------------------------------------------------------------------------- From: rudeboy Subject: re: MASM or TASM Date: 2 Feb 1999 17:26:08 it is really a matter of personal preference whether you use tasm or masm. i would recommend trying both with small programs and seeing which one you like better. neither one really works 'better' than the other, it just depends on what you want to do and which one 'feels' better to you. personally i use masm and for a beginner in win32 asm i would recommend picking up hutch's masm32, it has some good example code and everything you need to compile win32 asm progs. (if you grab the lib's too) -rudeboy ------------------------------------------------------------------------------- From: Iczelion Subject: re: MASM or TASM, thanks rudeboy Date: Mon, 08 Feb 1999 21:30:26 Think I'll continue using TASM then. unless I can get hold of Petzold's book (which is for MASM as I understood) I was just worried that TASM wouldn't support win32 programming good enough anyway, thanks again :D -H- =============================================================================== From: Craftie Subject: Help! Need to display DEC value of regis Date: 1 Feb 1999 02:26:18 Hello...I need some help on an ASM keygen im writing...I use TASM...The HEX value of the serial is in EDI....I need to display the DEC contents on the screen how do I do this? Do I convert HEX to DEC to ASCII? IF so, how? =============================================================================== From: megablast Subject: information on invoke? Date: 3 Feb 1999 03:47:19 Does anybody have any information on the invoke command, used with masm32? ------------------------------------------------------------------------------- From: Pusillus Subject: re: information on invoke? Date: 4 Feb 1999 07:12:36 Get this new help file from Iczelion page : http://catalyst.intur.net/~Iczelion/win32asm/files/masmhelp.zip ------------------------------------------------------------------------------- From: Shadow Subject: re: information on invoke? Date: 30 Mar 1999 13:25:19 Invoke is almost like tasm call: Invoke MessageBoxA,0,offset xx,offset xx,MB_OK C style call ;) =============================================================================== From: Henry Takeuchi Subject: re: Has anyone used EM_SETCHARFORMAT? Date: 3 Feb 1999 18:14:56 :Problem: :I would like to color some text in my Rich Edit control. :After I load the CHARFORMAT struc :I use the following Send Message : :INVOKE SendMessage,hREdit,EM_SETCHARFORMAT,SCF_SELECTION,ADDR :chf : :after which I receive a return value of 0, which means it did :not work. : :CHARFORMAT STRUCT : cbSize DWORD ? : [...snip...] :CHARFORMAT ENDS When a structure has a cbSize field at the beginning, you must set it to the size of the structure before it can be used. Also, watch out for any dwFlag field that needs to be set or zeroed out. Not familiar enough with MASM 6, but something like: MOV chf.cbSize, SIZE CHARFORMAT ------------------------------------------------------------------------------- From: Ewayne Subject: re: Has anyone used EM_SETCHARFORMAT? Date: 13 Feb 1999 13:41:44 The problem was the CHARFORMAT structure I eliminated the first word pad alignment and everthing works OK. CHARFORMAT STRUCT cbSize DWORD ? ;_wPad1 WORD ? dwMask DWORD ? dwEffects DWORD ? yHeight DWORD ? yOffset DWORD ? crTextColor DWORD ? bCharSet BYTE ? bPitchAndFamily BYTE ? szFaceName BYTE LF_FACESIZE dup(?) _wPad2 WORD ? CHARFORMAT ENDS Thanks =============================================================================== From: confused Subject: EM_SETPARAFORMAT Date: 6 Feb 1999 04:07:23 Anybody gotten EM_SETPARAFORMAT to work? I have tried everything to get the alignment from right to left to center. It says that it performs okay, but the results aren't happening. ------------------------------------------------------------------------------- From: Iczelion Subject: Line Numbers Date: Sat, 06 Feb 1999 07:56:07 I would like to display line numbers both in my status bar and in the RichEdit control's window. Does anybody know how to do this? I tried to use the EM_SETPARAFORMAT message with the PFN_BULLET in the numbering section, but it doesn't seem to have any affect at all. Thanks, Chris Hobbs =============================================================================== From: Iczelion Subject: /subsys:console|windows Date: Sat, 06 Feb 1999 09:57:40 I don't have a computer capable of running softice, so I have to ask this instead of just finding out myself, but... what exactly is the difference between LINK with /subsystem:console and /subsystem:windows _besides_ changing the entry point from WinMain to main? What I'm aiming for is: I want a program that, when started from a dos box, inherits the stdout of the dos box like any normal console app. But when its started by Run... or explorer or a shortcut, it knows it and stops itself from opening a console. I also want the process to be run "detached" so that it returns to the command line immediately but maintains a HANDLE to the dos box's stdout. So, the first guess would be to have a /subsystem:console program, call GetStdHandle() and check if it returns INVALID_HANDLE or not. If it returns a good handle, we're in a dos box and we've got the handle to stdout that we want. But the dos box is waiting for us to terminate, when we really wanted to be detached anyways. And if we're run from Run.. or the GUI, a dummy console is opened by default and its annoying. Now, my second guess is to have a /subsystem:windows, but those are always CreateProcess'd as detached, and according to the Win32 API docs I have, detached processes never inherit their parents' console handles, which is what I want. Basically I want, either, a /subsys:win app that, if called from a dos box, gets a handle to that box's stdout. Or, a /subsys:console app that doesn't open a dummy console if its _not_ started from a dos box. I realize there's a problem with having a volatile handle, ie. having a handle to a dos box's stdout and then having the dos box closed and then, after, trying to use the handle... but whatever, does anyone know what I'm talking about? Why do I want to do this? I don't actually remember, but its interesting to me and someone might know. frink =============================================================================== From: hiroshimator Subject: platform SDK? Date: 9 Feb 1999 20:47:09 does anyone know the URL of this MS SDk because I have searched but I can't find it anymore :( (I already had the DDK but I read that you need the platform SDK too for win 32 asm) thanks a lot ------------------------------------------------------------------------------- From: -H- Subject: re: platform SDK? aha found it :) Date: 10 Feb 1999 11:00:13 http://msdn.microsoft.com/developer/sdk/platform.htm =============================================================================== From: John Bauman Subject: Calling 32bit interrupt from 16bit mode. Date: 10 Feb 1999 00:12:40 Is it possible to call a 32bit(pmode) interrupt for 16bit (rmode)? I want to add internet access to dos programs by having them call an interrupt that is in a vxd, and I want to know if it will work. =============================================================================== From: Hobbs Subject: re: Creating files from a resource. Date: 10 Feb 1999 20:39:39 :Yep... I tried that, it jsut kept generating 0 byte files, i used :the pointer returned from lockresource as the parameter to writefile.. : ::( I ran into the exact same problem. The way I worked around it was by specifying exactly the number of bytes to write. I found this by looking at the files properties before I compiled it in. Example: ;===================================== ; Write the data to the help file ;===================================== invoke WriteFile,hFile,hAssemble,302336,offset written,0 I also found that SizeofResource didn't work either. Hope that this helps. =============================================================================== From: Kantox Subject: Winsock programming Date: 11 Feb 1999 08:40:17 i understand how i can connect a socket to a remote socket and how to send/recieve data using this socket, but i don't understand how i can open a specific port (123 for example) on my computer and then to listen for incoming connections on this port? i have read about the listen() and accept() API's but i can't find a way how i can specify the port number on which i want to 'listen'. any help appreciated :-) =============================================================================== From: z2sTra Subject: Comparing ARRAYS in ASM Date: 12 Feb 1999 09:03:30 Given 2 arrays A & B : A = [1,2,3,4,5,6] of byte; B = [1,2,3,4,5,7] of byte; Problem : Compare the two arrays and conclude that they differ by one element only. Question : Is there any way of comparing A & B using few instructions than making 36 comparisons ? I mean is there any mathematical trick (Sum, Difference,...) that can be used in order to avoid making all the comparisons ? Many thanks ------------------------------------------------------------------------------- From: BitRAKE Subject: re: Comparing ARRAYS in ASM Date: 13 Feb 1999 01:33:59 If the arrays are sorted and don't have redudant items then the comparison is a lot easier. If the elements can be anything then you have to test them all. Shortcuts are made by taking advantage of rules in the environment in which your working. If you create rules for the arrays, then you can take advantage of those rules in your code. ------------------------------------------------------------------------------- From: Iczelion Subject: re: Comparing ARRAYS in ASM Date: 13 Feb 1999 10:18:27 Use the string comparison instruction. mov esi, offset ArrayA mov edi, offset ArrayB mov ecx, [size of array] repe cmpsb jne ArrayDiffer ------------------------------------------------------------------------------- From: Calaban Subject: re: Comparing ARRAYS in ASM Date: 17 Feb 1999 02:46:16 Heya, Unless your arrays are going to be very small, you'll definitely want to sort them first. Once you've sorted them both, then you can take advantage of the expected dataset. Are the possible values very small, with a large dataset? (i.e., only 0-9 possible, with 10,000 elements?). If so, then you can tokenize each unique element and count tokens, comparing the qty of each token to give you a total qty of difference. I'm assuming that the arrays have to be the same size. If not, then you'll have to handle the differencing cases, etc. If there are a large # of possible values, and a large # of elements, then you're pretty much stuck with a sort and a compare. You can tabulate as you go on, incrementing thru the array and comparing item-by-sorted-item. It's not going to get much faster than that. btw, note that some instructions are slower than others depending on CPU type. In particular, the SCASB and CMPSB instructions are quite slow on 586+, even when used with REPNE, etc. prefixes. In an example shamelessly stolen from Agner Fog's Assembly optimization manual (highly recommended), replace it with loops. This example is actually a strlen() replacement. It's easy to modify into a comparison, however. Example 1.10: STRLEN PROC NEAR MOV EAX,[ESP+4] ; get pointer MOV EDX,7 ADD EDX,EAX ; pointer+7 used in the end PUSH EBX MOV EBX,[EAX] ; read first 4 bytes ADD EAX,4 ; increment pointer L1: LEA ECX,[EBX-01010101H] ; subtract 1 from each byte XOR EBX,-1 ; invert all bytes AND ECX,EBX ; and these two MOV EBX,[EAX] ; read next 4 bytes ADD EAX,4 ; increment pointer AND ECX,80808080H ; test all sign bits JZ L1 ; no zero bytes, continue loop TEST ECX,00008080H ; test first two bytes JNZ SHORT L2 SHR ECX,16 ; not in the first 2 bytes ADD EAX,2 L2: SHL CL,1 ; use carry flag to avoid a branch POP EBX SBB EAX,EDX ; compute length RET ; (or RET 4 if pascal) STRLEN ENDP I hope that helps, __Calaban =============================================================================== From: PeterBee Subject: Win32.hlp Date: 14 Feb 1999 18:47:23 Where can I find a Win32.hlp? Please anyone? ------------------------------------------------------------------------------- From: anybody Subject: re: Win32.hlp Date: 16 Feb 1999 19:54:43 Look my friend !! http://catalyst.intur.net/~Iczelion/assembly.html :I did look hard, but couldn't see it - still can't. :Found at http://www.borland.com/techpubs/vdBASE as w32hlpup.zip :from ftp.inprise.com. :I am newly fascinated by this assembly language. Your site is :such an incredible help. Many thanks! =============================================================================== From: Andrew Tucker Subject: member vars as assembly args Date: 16 Feb 1999 16:36:47 I am trying to use a member variable as an argument to the x86 fld and/or fstp instructions. Here's the code: class ExtendedFloat { public: ExtendedFloat(double dbl) { memset(m_fltData, 0, sizeof(m_fltData)); ConvertDoubleToExFloat(dbl); } //operators operator double() { return RetrieveAsDouble(); } private: BYTE m_fltData[10]; void ConvertDoubleToExFloat(double dbl); double RetrieveAsDouble(); }; void ExtendedFloat::ConvertDoubleToExFloat(double dbl) { BYTE *pbuf = m_fltData; __asm { fld dbl; fstp TBYTE PTR pbuf; }; return; } double ExtendedFloat::RetrieveAsDouble() { double dbl; BYTE *pbuf = m_fltData; __asm { fld TBYTE PTR pbuf; fstp dbl; }; return dbl; } I would prefer to use m_fltData directly in the __asm blocks, but that won't even compile w/ VC6. Doing it the way I have it results in AV exceptions so I assume the argument addressing is off. If pbuf/m_fltData is replaced with a local char buffer[10]; instead, everything works perfectly. Thanks in advance for any suggestions. ------------------------------------------------------------------------------- From: Calaban Subject: re: member vars as assembly args Date: 17 Feb 1999 03:41:25 Hi, try: __asm { fld dbl fstp TBYTE PTR this.m_fltData }; this will compile with warnings. I tried your posted sample code, but it crashed horribly. The code above compiled & ran, yet turned out a 0 when I tried to verify results. Sorry I can't help you more, but I'm out of time. Good luck. __Calaban ------------------------------------------------------------------------------- From: Andrew Tucker Subject: re: member vars as assembly args Date: 17 Feb 1999 16:42:52 Thanks for the reply. I don't know what compiler you're using but the code didn't work for me with VC6. I did however figure out the problem - like I suspected, the addressing was off and I was missing a pointer dereference. If you change it to: BYTE *pbuf = m_fltData; __asm { fld dbl mov ebx, pbuf fstp TBYTE PTR [ebx] }; it works great. ------------------------------------------------------------------------------- From: Sergey Karebo Subject: re: member vars as assembly args Date: 26 Feb 1999 00:37:24 void ExtendedFloat::ConvertDoubleToExFloat(double dbl) { __asm { mov ECX, this fld dbl fstp TBYTE PTR ( [ECX]this.m_fltData ) } return; } double ExtendedFloat::RetrieveAsDouble() { double dbl; __asm { mov ECX, this fld TBYTE PTR ( [ECX]this.m_fltData ) fstp dbl } return dbl; } =============================================================================== From: Ewayne Subject: Slow syntax highlighting Date: 20 Feb 1999 00:38:38 I've written a text editor program using MASM and I'm doing syntax highlighting. If the file is less then 1,000 lines the speed is acceptable, but anything over 2,000 lines the screen update takes several seconds. The file is loaded in memory where I do the search for the syntax text and then translate that address to the screen buffer where I do a EM_HIDESELECTION (only one time). Then I do a EM_SETSEL and then a EM_SETCHARFORMAT, SCF_SELECTION and loop through that procedure untill I've reached the end of file. I've even tried LockWindowUpdate. I've looked at some commerical editors and they do syntax highlighting instantly no matter what the file size is. What am I missing? Thanks; Ewayne ------------------------------------------------------------------------------- From: Iczelion Subject: re: Slow syntax highlighting Date: 20 Feb 1999 02:49:29 What makes your syntax highlighting slow is that you scan through the whole file! You don't need to do that. You only need to update the screen, not the file. And only the portion of the file that is currently displayed at that. ------------------------------------------------------------------------------- From: Ewayne Date: 20 Feb 1999 04:45:56 Subject: re: Slow syntax highlighting I'm a little confused, I thought I was only updating the screen by using EM_SETSEL, and if I only update the portion that is displayed, what happens when I scroll. Would I have to detect the scroll and update the screen again? ------------------------------------------------------------------------------- From: Hobbs Subject: re: Slow syntax highlighting Date: 22 Feb 1999 20:02:05 You are only updating the visible screen if you get the first visible line and set the selection(EM_SETSEL) to the known visible end. In short, you have to guess and check as to how many lines are shown at that point in time. I am working on the same kind of thing and what I noticed was a lot of flicker on the first version that I wrote. This version was then replaced by one that, instead of processing the entire file only processed +/- 200 chars from current position. I have delayed this part for the time being becuase I couldn't get it to work correctly. - Hobbs ------------------------------------------------------------------------------- From: Ewayne Subject: Works OK, Syntax Highlighting Date: 23 Feb 1999 22:23:48 I finally got it to work, first I get the top visible line, then calculate the last visible line based on the font size and screen size for the full screen update. If I'm scrolling I check to see if it's up, down, page, or line that I check for in my RICHEDIT proc, (that is sub-classed) and pass that info to my Syntax proc that I use to determine which line and how many to update. If anyone would like the code let me know. Ewayne =============================================================================== From: Hobbs Subject: END OF FILE Date: 28 Feb 1999 19:20:59 I am processing a file byte by byte and my routine keeps ending because of the FF bytes in the file. I didn't create the file that I am processing, so I am not sure if the bytes belong or not. Am I doing anything wrong? Here is the code that I am using to perform the test: ;========================== ; get the last value ;========================== mov eax, hSrc_Memory add eax, Spot ;Index into file mov bl, BYTE PTR [eax] mov last, bl .if last == -1 jmp err ;Unexpected end of file .endif inc Spot ------------------------------------------------------------------------------- From: Ewayne Subject: re: END OF FILE Date: 3 Mar 1999 21:14:52 If you are doing a readfile you can extract the number of bytes read which is the file size. Then you can determine the EOF by subtracting the begining address of the file in memory from your Spot address and then compare the results with the number of bytes read. =============================================================================== From: BXT Subject: An icon in the system tray? Date: 28 Feb 1999 16:10:45 Hi! how could i get a window's icon into the system tray (not into the task bar) when it gets minimized? thanks in advance for any help! /BXT ------------------------------------------------------------------------------- From: dude Subject: re: An icon in the system tray? Date: 4 Mar 1999 10:13:49 use Shell_NotifyIcon You setup a NOTIFYICONDATA struct with your icon and the flags you want to handle and a user defined message to watch for in your WndProc. Then call Shell_NotifyIcon with the args NIM_ADD, ADDR notifyicondata to add the icon to the tray. Call it with NIM_DELETE to take it off. NIM_MODIFY, I believe it is, will change it if you decide to change say your icon or tool tip at any time, say maybe when network is down you add a red stop light or something like that. Use TrackPopupMenu to bring up a popup menu on a mouse click. I'm getting ready to port a C app to Win32 asm right now, because I'm too addicted to the size and speed, that does all this in C. I'll check back on this board in a couple of days and see how you are doing, have any probs re me or I find anything unusual I'll let you know. dude ------------------------------------------------------------------------------- From: Dude Subject: re: how set app to system tray??? Date: 26 Apr 1999 08:39:01 in WinMain().... invoke CreateWindowEx, 0, ADDR szAppName, ADDR szAppName, WS_POPUP, 0, 0, 0, 0, NULL, NULL, hInst, NULL .if(eax == NULL) MB szHwndFail ; my macro for MessageBox call KillMe ; Cleanup func I do, release semaphores, etc xor eax, eax ret .endif mov nid.hwnd, eax invoke LoadIcon, hInst, 500 ; icon in resource file mov nid.hIcon, eax mov nid.uID, 1 mov nid.uFlags, NIF_MESSAGE or NIF_ICON or NIF_TIP mov nid.uCallbackMessage, 101 ;@@@@@@@@@@@@@@@@@@@ ; Put icon in Tray ;@@@@@@@@@@@@@@@@@@@ invoke Shell_NotifyIcon, NIM_ADD, ADDR nid to take out just use... invoke Shell_NotifyIcon, NIM_DELETE, ADDR nid =============================================================================== From: Colin Subject: windows gui Date: 2 Mar 1999 10:30:32 Hello, I'm currently writing a pascal compiler that could generate Windows gui app but i'm having difficulties with the code generation. If any assembler programmer could help me (you don't have to know Pascal), please contact me (colin.laplace@wanadoo.fr). The code to be generated are very simple. Thanx =============================================================================== From: Daniel Ricardo Subject: Flash Bios coding Date: 3 Mar 1999 16:35:20 Can anyone supply some information and source code about Flash Bios assembly programming ? B.T.W.:The only code I have found about this was the source code of the virus "Win32.CIH". =============================================================================== From: Hassan Mir Subject: DOS/16-bit Under NT ---- Help :( Date: 4 Mar 1999 17:23:30 I have an old DOS program that runs finder under all other Windows but NT. It gives me all kind of errors and would not run. I am very ignorant in assembly and using this forum to cry for help. An help is greatly appreciated. In a nutshell I would like to know any piece of code written for DOS 10 years ago that would not run under NT. I am interested in interrupt 21h function 4bh and 2dh. My program's main EXE calls different EXE's and the program uses this call to do just that. The other thing is screen access, are there any assembly calls dealing with screen access that would not work? Please email me at hmir@sulcus.com or post it here. Thank You. ------------------------------------------------------------------------------- From: Jeremy Subject: re: DOS/16-bit Under NT ---- Help :( Date: 16 Mar 1999 01:01:00 I have a similar problem, except all my old programs run fine (being all Real Mode). However, any program that has anything to do with DPMI or protected mode seems to freeze on my NT computer. (NT 4.0 SP4) I wish I could help you, but I have no friggin' idea what's going on with it! =) Though it is kinda nice to hear that it's no just my computer... =============================================================================== From: Vitaly Subject: I need ASM instructions bytecodes for 80 Date: 7 Mar 1999 00:23:23 Hi everybody! I'm trying to build my own compiler (of my own language), and what I need is table of all instructions of 80x86 processors family. Let's explain what I'm looking for: As far as I know, all the instructions in the Intel family of processors are composed of bitfields, which define the width of operands (if it uses AL or AH or EAX ...), the "codebyte" of operation itself (MOV, ADD, SUB,PUSH ...), which registers are involved, the direction of the operation (mem-->register, register-->mem, immediate-->register...), and additional immediate value bytes and/or address (offset) bytes. Well what I need is a table explaining, for each ASM command, the bitfields for it so I can build a sequence of bytecodes from, say, this line of code: MOV EAX,[BP+4] or ADD EDX,ECX I know I can do it by using a table of "precalculated" values for each command combination, but I prefer to use the bitfields since the table will be VERY big and even preparing it is no easy task. Again, I'm not looking for making an assembler, (but I'm thinking of that too, so maybe :) I'm just looking for a simple way to build machine bytecodes for my compiler. I'm certain that someone should have some article (in any text format) describing the bitfields of the ASM operations, ot any link to place on the net where I can get it. If you have something like that please send me the article or some address on the topic to my mail address: blev50@hotmail.com Note: I REALLY need it to describe at least up to .386 instructions(!!!) since I build the compiler to make .EXE's for Win95/98. Thank you very much! -------------------- P.$. ;o) If you send me this info, and I'll succeed in my project, I'll put your name on the "credits" list if you wish ;) I'm not planning to involve additional people in my project, since I make the compiler for myself, but it is possible that I will publish it as freeware, too. If you interested the compiler is intended mainly for Win32, with C++ like syntax, but much more meaningful ;), and will be very object oriented, supporting all the Win32 API in a way much more handy than current C++ or ASM compilers give. It should be *VERY* fast, faster than any current compiler on the market (at least I hope it will be)... Instead of leaving you to worry about the complex API calls I plan to incapsulate objects like Windows and Controls in simple to use and extend classes. Now it's in the early development stage, I use Turbo Pascal 7.0 for DOS *grin*, and succeeded to parse "pascal"-like text to create perfectly working PE (Portable Executable) .exe file for Win32 that uses some API calls. I'll need to add some sort of type checking and struct/class management, but this will not be *too* hard. The TP7 is surprisingly easy and handy environment, but for serious project I think I'll port the compiler as a Unit to Delphi to support long file names and include built-in IDE with editor, resource compiler... shortly,make a complete IDE out of it. * * * END * * * =============================================================================== From: AsmFreek Subject: Win32.hlp version? Date: 8 Mar 1999 09:50:41 Hey... i just wanted to ask.. wich is the latest version of the win32.hlp file that's out there? i have one from 1996, but please tell me if someone has any newer than that... i know that Iczelion's page has a link to a win32.hlp, but i wuoldn't like to be downloading the same file that i already have... Thanx a lot... ------------------------------------------------------------------------------- From: Calaban Subject: re: Win32.hlp version? Date: 9 Mar 1999 20:43:44 here's one from 2/23/99: http://www.borland.com/devsupport/borlandcpp/patches/BC52HLP1.ZIP -Calaban =============================================================================== From: wbms Subject: Registry access Date: 14 Mar 1999 19:37:48 Can someone give me a win32asm example which demonstrate folowing function: RegOpenKey,RegQueryKeyEx etc.? Please. ------------------------------------------------------------------------------- From: dude Subject: re: Registry access Date: 17 Mar 1999 11:53:37 RegOpenKeyEx is pretty simple and can be found in any win32 help file. just invoke RegOpenKeyEx, HKEY_****, ADDR szSubKey, 0, KEY_***, ADDR hKey As for your other function you got going on there, there's no such beast that I can find nor ever used. There's RegQueryInfoKey which, again is pretty self explanatory in a help file, and gives you basic overall info on a key such as how many entries are under a key name, length of names, etc. Then there's RegQueryInfoEx which will give you the data in a key's subkey. include advap32i.inc and includelib advapi32.lib for your functions. =============================================================================== From: drkpurple Subject: DLL written in TASM Date: 15 Mar 1999 04:54:31 How do you export functions in a dll written for tasm and what are the commad lines to link it. thnx for your help =============================================================================== From: Jeremy Subject: Windows Access Date: 16 Mar 1999 01:07:32 Hey all. I have a few questions for all of you, and I hope you can answer them. =) Here goes: #1) How do you create graphics inside of a Window (preferrably working with Windows NT 4.0 but Windows 95 or 98 will be helpful). I assume you have to create a sort of canvas first, but I don't have any idea how. #2) How do you read access from the keyboard, mouse, gameports, or similar input devices without having some sort of input box or text field? #3) How do you access the sound card without playing an audio file? Thanks for your help!! ------------------------------------------------------------------------------- From: dude Subject: re: Windows Access Date: 17 Mar 1999 09:18:48 :#1) How do you create graphics inside of a Window (preferrably :working with Windows NT 4.0 but Windows 95 or 98 will be :helpful). I assume you have to create a sort of canvas first, :but I don't have any idea how. Get a Handle to the Device Context (HDC) of the Window is the easiest. Watch for WM_PAINT msgs and hahdle them in there. Or, Create a Device Context in memory, do GDI functions on the device and BitBlt them to another real window's HDC. There's Direct Draw API also. Many ways to do this. For Win32 API, look into CreateDC, GetDC, CreateCompatibleDC, all the GDI functions like BitBlt, LineTo, CreateDIBSection, etc. :#2) How do you read access from the keyboard, mouse, gameports, :or similar input devices without having some sort of input box or :text field? SetWindowsHook(), preferably in a DLL so you can spy on other threads. Or write a VXD to do it. :#3) How do you access the sound card without playing an audio :file? Not much good at this one. Have run across it more looking at DirectDraw code, though the win32 api does contain some functions for sound card stuff. The SDK has some wave stuff too. ------------------------------------------------------------------------------- From: Jeremy Subject: re: Windows Access Date: 17 Mar 1999 21:39:46 Thanks for the help, but I still have a few more questions. #1) How do you create a DLL or a VXD, and integrate it into the program? (I'm VERY new to Win32 Assembly, but I'm learning. =)) #2) Is there a way to DYNAMICALLY load DLL files? In case that's confusing, what I mean is can a user choose which DLL files to load and which not to without having a list of all the possible DLL files in the program itself? #3) If the answer to #2 is no, is there a way to open a file with Windows, and have it be able to execute code in that file? I know protected mode can be very difficult with privilage levels. Thanks for the time! ------------------------------------------------------------------------------- From: wbms Subject: re: Windows Access Date: 18 Mar 1999 19:59:20 :SetWindowsHook(), preferably in a DLL so you can spy on other :threads. Or write a VXD to do it. VXD is a big head pain :) So it's better to use SetWindowsHook(). But how to use SetWindowsHook() without .dll? ------------------------------------------------------------------------------- From: dude Subject: re: Windows Access Date: 19 Mar 1999 10:23:25 To use it without a dll, you have to be hooking msgs from your own module. Like a thread you create and the HookProc is in your own code, you don't have to use a dll for this. If you don't own the thread though, the HookProc must be in a dll. Sounds more like a debug feature when it's used in your own code. As for the other guy wanting to dynamically load dlls, sure, you can use LoadLibrary if you want. But since you are new to Win32 coding, I'd suggest getting a good Win32 API book, like Programming Windows 95 by Petzold or Advanced Windows by Jerry Richter. Those two will help you along, if you want to do VXDs, try Systems Programming for Windows 95 by Walter Oney. These are all great books to help you. If you want a quick start, lookover Iczlion's ASM page, he has some tutes there that are great and help you in many areas from easy to adv, one happens to be how to load a dll and call it by ProcAddress or by statically binding the code in your exe. Good luck! ------------------------------------------------------------------------------- From: wbms Subject: re: Windows Access Date: 19 Mar 1999 17:53:41 There is a good sample on a Stone's page as .dll example and even with SetWindowsHook(). coding, I'd suggest getting a good Win32 API book, like Programming Windows 95 by Petzold or Advanced Windows by Jerry Richter. Those two will help you along, if you want to do VXDs, oh... vxdz. there are a lot of samples and it's not so hard to make vxd when examples in front of your eyes. But vxds isn't good for many purposes, i think, cause they're laaarge. try Systems Programming for Windows 95 by Walter Oney. These are all great books to help you. If you want a quick start, lookover Iczlion's ASM page, he has some tutes there that are great and As i can see his page is down already at least for 3 days. The really handy thing on it is a winsock tute, imho ;) help you in many areas from easy to adv, one happens to be how to load a dll and call it by ProcAddress or by statically binding the code in your exe. it's better to get example from Stone's page ;) Good win32asm source make everything clear :) Good luck! thank you very much :) ------------------------------------------------------------------------------- From: wbms Subject: re: Windows Access Date: 20 Mar 1999 14:46:46 :Okay, what's Stone's web address? =) http://www.cracking.net Enjoy it! :) The only thing i didn't find on it is a sample of mailer which use winsock functions. May be someone will send it to me? :) =============================================================================== From: Johannes Subject: full-screen-window Date: 18 Mar 1999 11:27:12 How can I Create a window which covers the whole screen and has no border and no titlebar ------------------------------------------------------------------------------- From: Iczelion Subject: re: full-screen-window Date: 19 Mar 1999 07:39:21 1. Use WS_POPUP style only. Your window will not have title bar and border. 2. Call GetDeviceCaps to retrieve the current resolution of the screen. 3. call MoveWindow to resize the window to cover the whole screen. If you also want your window to be always on top, add WS_EX_TOPMOST style in your CreateWindowEx. =============================================================================== From: JP Shankle Subject: general questions Date: 18 Mar 1999 13:27:38 I am an old MASM 6.0 programmer. I have been fighting Windows is seems forever. However now I have decided to bight the bullet and join the Microsoft monopoly. Do I scrap MASM 6.0? It won't load on windows 95 anyway. Get message "c: bad full path \windows\temp" when trying to load MASM. I have downloaded from the MAS32 homepage the following: L2inc.exe, masm32, masmhelp.zip, winin108.zip, libz.exe, masm32v3.zip. I really don't want to go to Microsoft to get the platform---- thing - must I? Now that I have all this what goes where? Any help would be appreciated. J.P. Shankle ------------------------------------------------------------------------------- From: rudeboy Subject: re: general questions Date: 18 Mar 1999 21:24:51 no, if you have masm32 and libz.zip, you have everything you need to start coding. masm 6.11 (i think) is included in masm32. You may want/need to set up some environment variables in order to get it to work, like TEMP, INCLUDE, LIB, PATH, etc... -- The RudeBoy =============================================================================== From: wbms Subject: Win32 Api hook Date: 18 Mar 1999 19:51:47 Is there way of hooking winapi functions instead of methods which uses .dll ? I need a win32asm sample. ------------------------------------------------------------------------------- From: Iczelion Subject: re: Win32 Api hook Date: 19 Mar 1999 07:07:11 There is no documented way to *hook* winapi. You can use message hooks like journal hook, etc. But there is no winapi hook. That's why you have to find some devious undocumented way to do that. ------------------------------------------------------------------------------- From: Iczelion Subject: re: Win32 Api hook Date: 21 Mar 1999 14:37:50 Funny this subject came up, because I am wanting to make such a spy right now. *Is* there an undoc way? I have d/led spies and looked over alot of code on the win sdk and I see alot of msg spies, but I see no real function spies. If there is a way Iczelion, can you point us in the right direction? I don't have alot of time to spend online for phone reasons or I would have dropped by #win32asm and asked there. Basically, all I want to do is not only be notified of posted events to the system, but say when an app calls one of the api funcs from the system dlls and know which func it called. I have some vxd code that looks over threads and stuff, but not anything that peers into actual calls. Is it possible for this to be done in a reasonable way? I had once written a winsock.dll in C that just got the proc addresses of the funcs out of the real winsock.dll and forwarded the info to the calling app and then wrote to file the functions called. This got hairy and I couldn't handle all the private funcs of course. Any way other than this to do it that you'd be willing to hint at? You want a global api hook. And there is some portability problem here. You can code a global api hook under Win9x by patching the system dlls at the entry points of the functions you want to monitor to point to your own code. But I don't know about NT and my guess is that it will not work on NT. I haven't done any research about VxD yet so I can't tell you if it's possible for a VxD to trap function calls. =============================================================================== From: Shadow Subject: win32 console print ? asciiz string? Date: 19 Mar 1999 07:51:48 I don't know how print to screen in console mode. ------------------------------------------------------------------------------- From: dude Subject: re: win32 console print ? asciiz string? Date: 19 Mar 1999 10:40:47 printf()...hehe, um, try invoke GetStdHandle, STD_OUTPUT_HANDLE .if(eax != INVALID_HANDLE_VALUE) mov hConsole, eax invoke WriteFile, hConsole, ADDR szBuf, nBufLen, ADDR dwWrote, NULL .end something along them lines, you can write to a modem or a printer, pretty much anything you like with WriteFile. ------------------------------------------------------------------------------- From: Shadow Subject: INVALID_HANDLE_VALUE with GetStdHandle Date: 22 Mar 1999 06:02:53 Not so hard, but now main problem is that GetStdHandle always returns invalid_handle_value.. code: call GetStdHandle,STD_OUTPUT_HANDLE cmp eax,INVALID_HANDLE_VALUE je @@error I don't know why. I compiled code using tasm5.0 ------------------------------------------------------------------------------- From: dude Subject: re: INVALID_HANDLE_VALUE with GetStdHand Date: 23 Mar 1999 09:37:59 hmmm, not sure, make sure INVALID_HANDLE_VALUE is equ -1. Sorry I have been trying to get Windows NT on a new box with Win98 preinstalled, so I don't even have a compiler up and running on this thingto find out what's up with it. Basically, after writing that 1st response, I thought about it, you just need a Handle to your console for it. GetWindowLong querying for HWND may work. I have done something similiar this way by using CreateFile making it a console and then writing to it, but it was in c. Hopefully I can get NT up and running on this thing sometime today and install masm and vis c++ and I'll look at it and see how it works. I'm having a *horrible* time doing this tho and am about to fdisk and reformat and say screw win98 until I get a second drive. :( ------------------------------------------------------------------------------- From: Henry Takeuchi Subject: re: INVALID_HANDLE_VALUE with GetStdHand Date: 26 Mar 1999 02:41:15 Standard GUI apps aren't guaranteed to get standard I/O. Console Applications do get standard I/O. Use /ap instead of /aa when using TLINK32. Or else, try getting a handle after creating a console with AllocConsole. ------------------------------------------------------------------------------- From: Pavel Pergamenshchik Subject: re: INVALID_HANDLE_VALUE with GetStdHand Date: 27 Mar 1999 21:10:27 I'm having the same problem..... Tried compiling my program with switch and used AllocConsole. It doesn't help much. GetLastError gives error number 1 (Incorrect function). What's that supposed to mean? ------------------------------------------------------------------------------- From: Shadow Subject: re: INVALID_HANDLE_VALUE, solution found Date: 30 Mar 1999 08:25:08 I don't know, but mine problem was corrected when I compiled my app as consoleapp, there was nice mistake in my makefile and tasm compiled my consolemodeapp as gui app.. nice =============================================================================== From: Shadow Subject: re: patching files under w32asm? Date: 19 Mar 1999 07:56:27 :btw. where i could find some more references/recources for :programming fileio stuff if the executable must be run in :windows?!? Using api calls like CreateFile - open file WriteFile - write to file SetFilePointer - seek CloseHandle - close file These are winapi calls, get example from win32api command reference. =============================================================================== From: LearnRVthing Subject: conversion Date: 20 Mar 1999 00:54:53 Hello, Here is my problem: Conversion(stringSource, baseSource, baseDest, &stringDest); SetDlgItemText(IDC_EDIT3, stringDest); Conversion is written in Asm and i got stringDest in esi but after that what should i do in order to make the right stringDest in SetDlgItemText(). please help thanks =============================================================================== From: KrYpToN Subject: Resource editors Date: 20 Mar 1999 10:58:33 Hi, I've been studying Net Walkers GETLOADER 1.1 and I'm having difficulties opening the .rc files with an editor. I have tried Borland Resource Workshop and Symantec Resource Studio but they wont open it, which resource editor should I use? =============================================================================== From: Anon Subject: Using EM_STREAMIN Date: 21 Mar 1999 00:23:31 Hi. I'm using MASM, and i'm trying to make my RTF text box read text files using EM_STREAMIN. My problem is the program won't read the text file. Below is the snipplets of code that i'm trying to use. Any help would be appreaciated. Thanks! ;... Open File mov edstream.dwCookie, offset hFile mov edstream.dwError, 0 mov edstream.pfnCallback, offset EditStreamReadCallback invoke SendMessage, ctxtEdit, EM_STREAMIN, SF_TEXT, addr edstream ;...Close File EditStreamReadCallback proc dwCookie:DWORD, pbBuffer:DWORD, cb:DWORD, pcb:DWORD invoke ReadFile, dwCookie, pbBuffer, cb, pcb, NULL ret EditStreamReadCallback endp ------------------------------------------------------------------------------- From: Iczelion Subject: re: Using EM_STREAMIN Date: 1 Apr 1999 02:24:58 First thing, you want the text in RTF format, you must use: invoke SendMessage, ctxtEdit, EM_STREAMIN, SF_RTF, addr Second, the return value of the callback is very important. If you return 0 in eax, the richedit control will continue with the operation but if you return a nonzero value in eax, richedit control will terminate your operation. In your case, you should check if the end of file is reached. If there are still some data left in the file, you must return 0 in eax. Since ReadFile returns 1 in eax on success, your richedit control will not process your data. ------------------------------------------------------------------------------- From: Ewayne Subject: STREAMIN from memory ? Date: 12 Apr 1999 18:45:51 Is there a way to do streamin to a RichEdit control from memory after the file is loaded into memory? Thanks; Ewayne =============================================================================== From: Ehkahk Subject: How do you create a button(control) ? Date: 21 Mar 1999 03:03:18 How do you create a windows default button and place it on your app's window. Ive noticed people doing win asm 2 different ways 1st-> pushing all the paramaters for api calls onto the stack then calling it OR 2nd-> doing this-> call Rectangle PASCAL, hdc, 1,1,100,100 I use the 2nd way, there's examples of creating buttons for in the 1st way, i cant figure it out cause it's got these create args and stuff and tasm doesent accept that... can you please help? =============================================================================== From: Ricardo Subject: Has anybody created INC files for Direct Date: 26 Mar 1999 22:29:49 Hello, im considering making a game for Direct3D in assembly. I wonder if anybody has translated the headers to assembly. If not, is there any utility to make that translation, I tried h2inc but it just doesnt work for that headers. Thanks in advance for any help. =============================================================================== From: Ricardo Subject: How do I convert a 32 bit float to ascii Date: 26 Mar 1999 23:07:36 Does anybody know where can I find sample sourcecode to do this? thanks in advance for any help ------------------------------------------------------------------------------- From: kill3xx Subject: re: How do I convert a 32 bit float to a Date: 28 Mar 1999 02:24:30 http://www.df.lth.se/~john_e/gems.html byz kill3xx =============================================================================== From: _Dude_ Subject: Help with Dll's Date: 27 Mar 1999 04:55:31 Ok I have a stupid question. One, what language are Dll's written in, and 2, how can I take one apart? Thankx ------------------------------------------------------------------------------- From: Ricardo Subject: re: Help with Dll's Date: 29 Mar 1999 06:06:57 Dlls are librarys of functions that a program uses. They are like a windows executable. and can be done in C, C++, assembly or almost any language that can compile in windows. I didn't understand the take apart part. but you can use a dissasembler to read it, just like a windows exe file. =============================================================================== From: Anonymous Subject: MDI applications Date: 27 Mar 1999 22:45:46 How do I create a multiple document interface in win32asm? Also, what would be the advantages, sofar I seem to be allright just using multiple child wildows. =============================================================================== From: Tamer Samy Subject: Help for hardware interrupt Date: 28 Mar 1999 03:56:03 Hi.. all assembelers guru ; do you have any idea about calling hardware interrupt in windows95 ..by vxd or any thing does any one have a sample ..?? please email me ..thanks i love you win32asm.cjb.net ------------------------------------------------------------------------------- From: dude Subject: re: Help for hardware interrupt Date: 30 Mar 1999 10:22:04 I'm no guru, but I will tell you my exp with it. It Page Faults when I try it with reg asm calls. From what I gather, you must include vxd compiled code using VxdCall or DosCall funcs. Or you get the offset into Kernel32.dll to those int calls and make a func pointer to them and call it *VxdCall and use it. MS toook out the calls by ordinal, then they took out calling any funcs to that dll by ordinal. But, remember they patch and change code when they want and it will break existing code. The only way I've had any success using int calls in Win95 is by making a 16 bit app. If you would like to try it using the Kernel32 offset, I have some code or check out the book or website for "Undocumented Windows 95." =============================================================================== From: Shadow Subject: SetConsoleMode?? Date: 30 Mar 1999 08:30:34 Another guestion. Is there way to stop console echoing? Let's say that I am reading console input using ReadFile, there was something about enabling under section SetConsoleMode, but nothing about disabling... =============================================================================== From: kool Subject: Syntax error using bswap Date: 1 Apr 1999 01:54:26 I am using the instruction "bswap eax" and MASM tells me there is a syntax error on "eax". Any suggestions? ------------------------------------------------------------------------------- From: Iczelion Subject: re: Syntax error using bswap Date: 1 Apr 1999 02:19:03 bswap is not available under 80386. You must use .486 or above in your asm source code. =============================================================================== From: mark Subject: VxD tuts for Win32 Date: 2 Apr 1999 00:50:03 Where could I get some good tuts/samples about writing VxD (win32) in Asm ? thanks. Mark =============================================================================== From: Ewayne Subject: How do you create a window within a Dll? Date: 6 Apr 1999 15:30:02 It goes through the motions, but nothing happens. ------------------------------------------------------------------------------- From: Dude Subject: re: How do you create a window within a Date: 6 Apr 1999 20:35:51 Not enough info. Are you calling ShowWindow() UpdateWindow() setting it's parent to Desktop or the calling exe? Are you posting msgs back to the caller or blocking calls by using SendMessage() anywhere? What's the return value of the CreateWindow()? Personally, I've only made DialogBoxes in a dll, but the routine is the same. ------------------------------------------------------------------------------- From: Ewayne Subject: re: How do you create a window within a Date: 7 Apr 1999 02:57:56 I figured it out I was using the wrong handle, but thanks anyway. =============================================================================== From: Jim Subject: Machine Code Monitor/Assembler Date: 7 Apr 1999 05:32:25 I just now am making the leap to x86 assembly programming. Where can I get an assembler/monitor for machine code and an online reference manual? Please respond to my hotmail address. Off the subject--C64 Emulation rocks. I'm very impressed with the accuracy of emulation. Unfortunately, 6502's with 65,536 bytes of RAM running at 1Mhz and 170K of storage on a 1541 floppy and 320x200 4-bit color and 3-voice sound no longer trip my trigger. =============================================================================== From: Ewayne Subject: DLL and Dialog Box Date: 7 Apr 1999 12:43:59 1. When I call the DLL and create a Dialog Box using the Module Instance of the DLL and the Dialog template within the DLL the Dialog comes up fine, but when I close the Dialog using EndDialog it crashes windows. 2. When I call the DLL and create a Dialog Box using the Module Instance of the main program and the Dialog template within the main program the Dialog comes up fine and closes fine. 3. I would like to use the Dialog template within the DLL, I'm I missing a step within the DLL? Thanks; Ewayne ------------------------------------------------------------------------------- From: Ewayne Subject: re: DLL and Dialog Box Date: 7 Apr 1999 15:08:27 I found the problem, I forgot to do a FreeLibrary and ExitProcess after I called the DLL. Ewayne =============================================================================== From: Dave Subject: TextOut/Drag--&--Drop Date: 7 Apr 1999 14:29:33 Can anyone advise how to display a database list in the main window, but only when selected from a dropdown menu. Also, I would like to use drag and drop to the main window from a selection highlighted in a combobox. Any recommendations would certainly be appreciated. =============================================================================== From: Darklighter Subject: files Date: 4 Apr 1999 21:59:19 Hi! How can i add some data at the end of a file? When i tried to do so... it just gets nulled... so i can't use it Can anyone tell me how to do it? ------------------------------------------------------------------------------- From: Shadow Subject: re: files Date: 6 Apr 1999 06:21:13 Use SetFilePointer to locate end of file and then use WriteFile to add some data. Remeber to open file in GENERIC_WRITE mode atleast.. ------------------------------------------------------------------------------- From: Darklighter Subject: re: files Date: 6 Apr 1999 08:59:34 sorry, forgot to tell that it was a win32 executable file i wanted to append data to... i tried putting a large buffer at the end of the file, and then i just removed the data with an hexeditor... then it worked fine to append, but doesn't it still take the memory? I wounder how i can append without that buffer at the end of the win32 .exe file ------------------------------------------------------------------------------- From: Shadow Subject: re: files Date: 7 Apr 1999 05:39:30 :WriteFile to add some data. Remeber to open file in GENERIC_WRITE As I said, you can append bytes to file without any "predefined" buffer. Just write bytes at end of file.. using WriteFile ------------------------------------------------------------------------------- From: Darklighter Subject: re: files Date: 10 Apr 1999 01:14:46 it works fine to get the bytes to the end of the file... but when i load the program, then the bytes i put at the end of the file are gone... and there is just some nulled memory. How can i do to let the program also be able to read the bytes i put at the end without the "predefined" buffer? ------------------------------------------------------------------------------- From: Iczelion Subject: re: files Date: 10 Apr 1999 02:00:48 PE files are not simple text files. A PE file has a header followed by an array of "sections". Sections are what segments used to be under Win16. Your code goes in code section, your initialized data is in another section and so on. When Windows loads a PE file, it reads the PE header to see where each section is located in the file and how large it is. Just adding data to the end of file won't help because the PE loader will ignore it. You have to increase the size of the section you appended data to. Just get hold of some PE file format manual and study it. =============================================================================== From: bTo Subject: Creating Custom Window Borders --&-- titleba Date: 5 Apr 1999 19:58:01 Here... I was trying to make a program which main window had a custom border and titlebar by processing the WM_NCPAINT message.. and i found out that if i used a rectangular border i had no problem at all. But here's my problem with non- rectangular borders: i can't erase the part that's not the border with whatever is on the background.. if anyone could help me with this i would be very thankful... =============================================================================== From: Tramper Subject: How to read in running file? Date: 6 Apr 1999 08:22:10 I tried to read data in a running exe-file for copying it. The new file had the same size but in it only nulls. Who can help me? ------------------------------------------------------------------------------- From: Iczelion Subject: re: How to read in running file? Date: 10 Apr 1999 02:10:38 Under Win32, processes run in separate memory contexts so they cannot *see* each other. In order to read data from another process, you have to somehow got the process handle of the process you want to read, then read the data using ReadProcessMemory. ------------------------------------------------------------------------------- From: Net Walker! Subject: re: How to read in running file? Date: 15 Apr 1999 23:05:55 Try CopyFile function in order to make a temporary copy of the running file. then, work on it instead of the original one. Net Walker! =============================================================================== From: Geoff Subject: Dll's Date: 8 Apr 1999 02:43:52 is there any way (program?) for me to create a ".lib" file for a dll that already exists? So I could use the library functions inside of them in my asm programs? Thanks, Geoff ------------------------------------------------------------------------------- From: Subject: re: Dll's Date: 9 Apr 1999 12:55:50 i dont know if there is such a program. but to use a function from a dll, just use LoadLibrary to load the dll. Then use GetProcAddress to get the address of the api, then call it. The only problem is to know how many parameters to pass to the function, but that is easy with trial and error i guess. ------------------------------------------------------------------------------- From: Calaban Subject: re: Dll's Date: 13 Apr 1999 02:20:20 From within ASM, you have to either deal with the format directly, or use a tool like "lib.exe" from MS compilers to create the .LIB & then take something like hutch's "L2inc.exe" tool to create a .INC file that you can include in your ASM program. I don't know of any other way than these two methods. Fundamentally, you need a list of arguments, and the size of those arguments. With most DLLs that are part of an API, you can create a function prototype very easily. With a 3rd party DLL that is undocumented, you're pretty much stuck with tinkering with it in order to figure out what the parameters are for (after you have the size & qty of arguments). -Calaban =============================================================================== From: Racso Subject: Fixing Windows Date: 8 Apr 1999 19:49:42 Is there a way to fix a window, so it can't be resized, but it can be moved about? If there isn't, how do you move a status window to make it centered on the bottom of a window? Thanks ------------------------------------------------------------------------------- From: Racso Subject: re: Fixing Windows Date: 8 Apr 1999 22:25:55 Ooops, hehehe. Nevermind. I wasn't updating the window. =============================================================================== From: Soso Subject: Keyboard inputs Date: 10 Apr 1999 17:12:48 How can I control all keybord inputs on my Pc Who can help me? =============================================================================== From: pruri Subject: user32.inc + kernel32.inc Date: 11 Apr 1999 13:30:45 hi ! i'm searching this files. Can somebody say where i can download it ? or if you have this file'S send it me, please. thanx a lot pruri =============================================================================== From: Alastair Subject: Windows graphics Date: 12 Apr 1999 01:37:43 How do you do graphics in Windows32? I've looked everywhere (including samples and the API reference), but all I can find is that you need to create an HDC. This isn't helping very much! :o) If anyone can give me an easy example with a lot of comments, or a simple text on how to do it, please, I'd be very grateful. Feel free to email instead of replying. Thanks! ------------------------------------------------------------------------------- From: Ron Subject: re: Windows graphics Date: 15 Apr 1999 17:39:26 Hi, I'm also learning Win32, and have an interest in graphics. Have a look at my web site www.rbthomas.freeserve.co.uk You should find two examples there. Sinewave.zip and Bezier.zip; these are translations of "C" examples from Petzold book into assemby for use in MASM32. Code and exe are included. Hope this helps. Ron =============================================================================== From: Ehkahk Subject: Help with MAKING DLL's in TASM HELP HELP Date: 12 Apr 1999 20:11:42 Hi i'm using TASM and it came with a example DLL for windows. Well when i compile it, it makes a dll file. Thats fine... I'm trying to call this dll from VB but it keeps saying it cant find the file name ->name of the dll file. I put it in windows\system, everywhere but same thing. So i start looking at other dll files (using properties in win95) and i notice they all have a VERSION tab which tells the company name, version, name etc, except, ONLY MINE DIDNT. I then was kinda figuring out that i had to use tasm32 and tlink32 instead of tasm/tlink... so i'm switched and set all the parameters that were needed and now it gives me the error->Fatal: 16 bit segments not supported in module dllwin.ASM So now i'm looking through everything and FIND some predefined symbols in the help file of TASM called @@32Bit <-- I want to know what this symbol is (actually i know what it is) but i want to know where do i place it, in the .asm file? the .def file? in the makefile? i dont know where and i'm sure i need this to fix that 16bit problem. Please help i'm in need. ------------------------------------------------------------------------------- From: Racso Subject: re: Help with MAKING DLL's in TASM HELP Date: 12 Apr 1999 20:40:33 Well, I don't use TASM. I use MASM, but I can tell you, if you put @@32Bit in the .asm file, you'll get an error. I would bet that you need to put it in the makefile, to tell the linker to use 32 bit segments when it creates the lib and dll files. I can't imagine a purpose for it to be in the .def file, but then, like I said, I don't use TASM. =) =============================================================================== From: SR1 Subject: Problem with win32 api :( Date: 13 Apr 1999 07:15:57 Why In my programs the API RegConnectRegistry doesn't work ? anyone can tell me an example of using it ? When it work and when not ? byz & thanx to all ------------------------------------------------------------------------------- From: dms Subject: re: Problem with win32 api :( Date: 14 Apr 1999 14:47:42 There are many reasons a API fail. Try to call GetLastError and check the error msg. ------------------------------------------------------------------------------- From: netzus6 Subject: re: re: Problem with win32 api :( Date: 14 Apr 1999 16:15:29 i know...I'v done that call and it talk about a DLL that can't be found. now i don't remember the right message ...anyway i'll post it ASAP byz :) netzus6 =============================================================================== From: Shadow Subject: DefDlgProc? Date: 13 Apr 1999 08:37:45 Why this function crashes my dialoxbox? it is created from rc file using DialogBoxParamA.. without DefDlgProc my dialog works great ;) ------------------------------------------------------------------------------- From: dOMNAR Subject: re: DefDlgProc? Date: 16 Apr 1999 20:03:29 You should read Microsoft's API documentation before trying to use a certain API! Calling the DefDlgProc function from a *dialog box procedure*, will result in recursive execution, so you mustn't do that. // dOMNAR - See you all in #cracking / EFnet =============================================================================== From: Troll Subject: Who can help me????? Date: 13 Apr 1999 13:27:14 Hi I try to learn Win32 Assembly but I don't know much about it. What for literature is available and to recommend????? And where can I find good example sources????? Please help me!!!!! =============================================================================== From: Ehkahk Subject: in TASM, need help with 32bit registers Date: 14 Apr 1999 23:14:11 I know dos is not 32bit but tasm does allow you to do it with such as .MODEL LARGE (or huge) USES32 and with a .386 before all that. The only problem is, it still thinks it's 16 bit so the program will crash etc. I need some code or help with using 32bit stuff in dos. I need to get this stuff to work hehe Thanks ------------------------------------------------------------------------------- From: dms Subject: re: in TASM, need help with 32bit regist Date: 15 Apr 1999 02:29:24 get a dos extender, there are lots of free ones. =============================================================================== From: Jubee Subject: undefined symbol Date: 15 Apr 1999 01:12:49 hi all, i'm tring to convert some code from TASM to MASM 6.1x but i've encountered some problz when i use forwarded code symbols: invoke SetUnhandledExceptionFilter,addr xTermHandler invoke GetModuleHandle,NULL mov [hInstance],eax invoke WinMain,[hInstance],NULL,NULL,SW_SHOWDEFAULT xTermHandler: invoke ExitProcess,eax invoke InitCommonControls -> err: undefined symbol : xTermHandler i'm not confident with MASM but i'm wandering why this simple code does not work!?!! Any idea? tnx Jubee ------------------------------------------------------------------------------- From: Ewayne Subject: re: undefined symbol Date: 16 Apr 1999 06:27:26 I think this might work. xTermHndl dd xTermHandler . . . invoke SetUnhandledExceptionFilter,xTermHndl . . . . Ewayne ------------------------------------------------------------------------------- From: Iczelion Subject: re: undefined symbol Date: 16 Apr 1999 23:57:17 The reason it doesn't work is that: addr directive cannot handle forward reference. You have two alternatives: 1. Declare a function prototype somewhere before you refer to the label like: xTermHandler proto This *function* prototype declares xTermHandler as a function which doesn't take any parameter. 2. use lea instruction: lea edx,xTermHandler invoke SetUnhandledExceptionFilter,edx ------------------------------------------------------------------------------- From: Jubee Subject: re: undefined symbol Date: 17 Apr 1999 03:57:43 hi, first i should tnx u and Ewyane for ur answers.. i've resolved this problz just after my post :P in this simple way: push offset xTermHandler call SetUnhandledExceptionFilter but this only a trick.. and don't solve the real problm: for example i'm used to build msg_handlers tables directly in the codeseg after the dispacth code and now i'm forced to declare them in the dataseg.. i mean.. this is not a MASM vs TASM thread but it's really annoyning that MASM cannot handle correctly forward code symbols without and reg load or a PROTO declare :( cya Jubee =============================================================================== From: panda Subject: Ring0 in NT Date: 15 Apr 1999 16:38:09 Does anybody know how to get Ring0 privilege in NT? ------------------------------------------------------------------------------- From: dOMNAR Subject: re: Ring0 in NT Date: 16 Apr 1999 19:53:01 Write a kernel mode driver. You can't switch to Ring0 from a user mode application, since that would be a severe security issue. But writing a kernel mode driver will make it possible to communicate with it from a user mode application, and let the driver perform your Ring0 tasks. Keep in mind that you will need administrator rights in order to install a driver. Windows NT Device Driver Kit (DDK) will give you all the information you need to build a driver. If you don't know anything about NTAPI (NT's internals, a mostly undocumented API), you'll need to get learning. The DDK has information on the neccesary API's for driver development. // dOMNAR - See you all in #cracking / EFnet =============================================================================== From: Kuwala B Subject: Need Tic-Tac-Toe in assembly.....help... Date: 16 Apr 1999 04:47:49 I need a tic tac toe program in assembly. I've never used assembly before and our teacher only gave us two weeks to do the assignment. Any help would be appreaciated greatly. ICQ me at 24600260 Thanks ------------------------------------------------------------------------------- From: Calaban Subject: re: Need Tic-Tac-Toe in assembly.....hel Date: 19 Apr 1999 21:26:19 Sounds like he's taking Randall Hyde's class in ASM lang (or a class that uses the same textbook). They have a tic-tac-toe program assignment in that class. This is fairly pathetic, because RH's excellent "Art of Assembly" actually goes thru numerous examples in painstaking detail on EXACTLY how to create such a program (oddly enough, while he's berating weak students for not trying to figure it out on their own... hmm...). My suggestion to you is to RTFM... -Calaban =============================================================================== From: Michael LaChapelle Subject: STRUCture/array errors in MASM32 Date: 17 Apr 1999 17:33:48 I've been trying to create an array of STRUCtures where the STRUCture contains an array and I get the following error: "error A2187: must use floating-point initializer". It assembles fine under MASM 6.x. I've tried MASM32 v2 and v3. I don't know where to go to look for MASM32 updates, so I'm slightly stuck. Here's a modified example out of the MASM 6.11 book: ITEMS STRUC Inum DW ? Iname DB 'Item name' ITEMS ENDS item7 ITEMS 30 DUP () As I said, under MASM 6.11 this assembles fine, but under MASM32, this example stops on the 'item7' line and says "error A2187: must use floating-point initializer". I get the same error even if I change the 'item7' line to read: item7 ITEMS 30 DUP ({,}) Any clues??? I guess I might have to make an array of pointers and just use GlobalAlloc to reserve space for each structure definition I need, but I HATE losing time on a problem that should not exist! I spent three days trying to figure out what *I* was doing wrong - then I finally remembered that I had MASM 6.11 still installed and once I found that it worked fine there, I knew it was not my fault. Sigh. ------------------------------------------------------------------------------- From: Iczelion Subject: re: STRUCture/array errors in MASM32 Date: 18 Apr 1999 13:01:28 It looks like MASM 6.13 changes its internal method of defining default structure members. Under MASM 6.13, you should define the above structure like this: ITEMS STRUC Inum DW ? Iname DB 'I','t','e','m',' ','n','a','m','e',0 ITEMS ENDS ------------------------------------------------------------------------------- From: Michael LaChapelle Subject: re: STRUCture/array errors in MASM32 Date: 18 Apr 1999 22:25:14 ::I've been trying to create an array of STRUCtures where the ::STRUCture contains an array and I get the following error: ::"error A2187: must use floating-point initializer". [snip] :It looks like MASM 6.13 changes its internal method of defining :default structure members. Under MASM 6.13, you should define the :above structure like this: : :ITEMS STRUC : Inum DW ? : Iname DB 'I','t','e','m',' ','n','a','m','e',0 :ITEMS ENDS Well, that DOES work, but I guess I gave a bad example of what I REALLY need to do - what I need is something like: ITEMS STRUC Inum DW ? Iname DB 256 DUP (?) ITEMS ENDS Any clues on that? Thanks for the help, though! At least your example worked! :-) ------------------------------------------------------------------------------- From: Iczelion Subject: DUP operator error Date: 19 Apr 1999 04:03:46 You got me here. After running some tests on that problem, I conclude that it's a bug in dup operator. You can't even use 1 dup({}) hutch and I are working on a solution to this. We may finally have to patch MASM itself, if that's what it takes. ------------------------------------------------------------------------------- From: Iczelion Subject: re: STRUCture/array errors in MASM32 Date: 19 Apr 1999 16:42:25 After examining the disassembled listing of ml.exe, I don't think it'll be easy to understand the working of ml.exe. It was written in highly optimized C/C++. However, I come up with a solution, admittedly, it's an ugly one but it works. Use a MACRO like this: STRUCTARRAY macro VarName,StructName,Number:=<1> VarName StructName <> REPEAT Number-1 StructName <> endm endm .data STRUCTARRAY item7,ITEMS,30 Until M$ comes up with a fix in MASM 6.14, I guess we will have to tolerate such macro. ------------------------------------------------------------------------------- From: Iczelion Subject: MASM 6.14 update Date: 20 Apr 1999 07:59:23 http://support.microsoft.com/support/kb/articles/Q228/4/54.asp ------------------------------------------------------------------------------- From: Iczelion Subject: Bug fixed in MASM 6.14 Date: 20 Apr 1999 08:56:48 That bug is fixed in MASM 6.14 update. I tried it with the above structure array and it assembled fine. Cheers! =============================================================================== From: SynthHack Subject: Problem declaring local array Date: 19 Apr 1999 05:23:09 Hello, I have problems declaring a local array. What I do is: LOCAL MyArray :BYTE 100 DUP(?) And it doesn't work (I don't remember the error). I came over this problem by creating a structure with one member and then defining MyAray as that structure. So in order to access the array I had to type MyArray.aname .... you understand.... Isn't there a way to declare a LOCAL array directly? (without using structures or other such "tricks") thanks for your time /Andreas ------------------------------------------------------------------------------- From: Iczelion Subject: re: Problem declaring local array Date: 19 Apr 1999 12:58:45 MyStruct STRUCT Item1 db ? Item2 dd ? MyStruct ENDS LOCAL MyBuffer[100]:BYTE LOCAL TestStruct[10]:MyStruct mov eax,TestStruct[5*sizeof MyStruct].Item2 ; access 6th structure =============================================================================== From: -M A C- Subject: Catching the DIAL UP Connection ... Date: 19 Apr 1999 20:15:46 Do someone know how to "catch" the Data that windows sends when you do a "Dial Up Connection" ? I mean, do someone know the API call that windows does to make the Dial Up Connection ?? :) Thanx in advance ... -M A C- ------------------------------------------------------------------------------- From: Dude Subject: re: Catching the DIAL UP Connection ... Date: 20 Apr 1999 10:34:37 the data is sent to a hidden dialog window called "Restoring Network Connections" after connection. You have to call EnumWindows, in a thread preferably, and in your EnumProc, look for GetWindowText on every window and compare it against the "Restoring Network Connections" and then SetWindowsHookEx into a Dll passing it the threadID of the dlg box and hook whatever you want. Personally, I have had trouble getting this window to behave properly, it seems to unhook my hooks. If you watch quickly, you'll see it minimze to the tray after it becomes visible, then turn into your modem light icon. This is a most unusual window, I've not been able to duplicate this path of minimizing without making the tray do weird things. As for the API calls to start the dialing, look at all the RAS funcs, like RasDial, RasEnumEntries, etc. I have to say I haven't messed with this window since Win95, so I don't know what it does in Win98. Use Spy++ or WinSight to check the window out. BTW, you must use a dll to hook this dlg box as it's a seperate thread. Good luck! ------------------------------------------------------------------------------- From: Calaban Subject: re: Catching the DIAL UP Connection ... Date: 21 Apr 1999 01:01:46 It's much easier to watch for the presence of the "Dial Up Connection" dialog & then hook the keyboard & trap the next 50 keystrokes or so. That assumes you're after what people are likely to type after attempting to connect to the I-net... I'd help you more, but I'm a firm believer that you should have to work hard for login names & passwords. (obviously if the password is cached, then you'll need to do some additional work... :-) -Calaban =============================================================================== From: V-man Subject: PE Unpacking Date: 20 Apr 1999 16:20:24 NEED A TUTE on how to unpack A PE manually has anyone tried to unpack bleem demo ? ------------------------------------------------------------------------------- From: Tukky Subject: Tutorials on hands PE unpacking Date: 21 Apr 1999 23:03:35 Where can I find tutotials that explains how to unpack PE files "by hands" ? Thank you in advance =============================================================================== From: Linuxjr Subject: Sound programming? Date: 21 Apr 1999 01:33:05 I was wondering is there a site about sound programming in 32 bit assembly. Meaning maybe possibly a project on how to write a recorder that will be able to save to any style format that a user wants his/her favorite waves to be so they can be able to share with friends with certain plays like mp3 or just regular waves or change real audio sounds to mp3 or waves. Any such projects out there? any tips or info would be greatly appreciated. =============================================================================== From: Racso Subject: DirectDraw Date: 21 Apr 1999 20:08:46 Is there anyone out there who can point me to a DirectDraw demo (perferably from DirectX version 3 or less) that works in MASM 6.13? Thanks! ------------------------------------------------------------------------------- From: Mike Bibby Subject: re: DirectDraw Date: 22 Apr 1999 20:19:15 Try Iczelion's excellent Homepage at: http://catalyst.intur.net/~Iczelion/win32asm/ It's got two demos of mine that you can download that should give you what you want. Any problems, email me at m_bibby@hotmail.com cheers, Mike Bibby ------------------------------------------------------------------------------- From: Racso Subject: re: DirectDraw Date: 22 Apr 1999 21:27:03 I've been there. None of the DirectX demos or tutorials work. =============================================================================== From: sc Subject: Access physical disks in Win32 Date: 22 Apr 1999 15:26:11 Hi there! I want to directly access (Read/Write) to physical disk (Hard disk and floppy disk) by Int 13h or any ways can. if you know any way to do, please help. Thank you very much! ------------------------------------------------------------------------------- From: Shadow Subject: re: Access physical disks in Win32 Date: 23 Apr 1999 11:22:03 Switch to ring0 and then use direct access. You can find some sources about ring 0 from www.cracking.net =============================================================================== From: noone Subject: any win32 asm virii coder looking for a Date: 25 Apr 1999 04:44:42 hello.. if you are a virus author and looking for somewhere to settle, i would seriously consider us. we are a win32 virus group. We code mostly windows virii. this is not for begginers.. you must know 32bit asm.. you must be able to code virii. so if this profile fits you and you would like to code for a group; meet some people that share same interests with you please respond here on this board and leave your e-mail address and i will get back to you a.s.a.p. thank you And for Iczelion: great tutorials, great examples.. keep up the work.. thanx bye ------------------------------------------------------------------------------- From: VagabonD Subject: re: any win32 asm virii coder looking fo Date: 25 Apr 1999 06:14:35 nice idea... e-mail me: vagabon_d@mail.ru =============================================================================== From: Shadow Subject: CreateProcess Date: 26 Apr 1999 06:48:34 Why CreateProcess with DEBUG_PROCESS don't work? ------------------------------------------------------------------------------- From: Dude Subject: re: CreateProcess Date: 26 Apr 1999 09:49:17 Not sure what you mean, what's eax after the call? Seems to work fine for me. ------------------------------------------------------------------------------- From: Shadow Subject: re: CreateProcess Date: 26 Apr 1999 10:02:19 Eax is true after call, but process program screen don't appear after call. why?