Simple build questions

; int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
_wWinMain@16 proc near

var_4= dword ptr -4
hInstance= dword ptr  4
hPrevInstance= dword ptr  8
lpCmdLine= dword ptr  0Ch
nShowCmd= dword ptr  10h

From what I see, the last 4 variables are parameters passed to the WinMain function. In addition, var_4 must be an int variable, declared later in the function body. Now I have a couple of questions:

a) What is the word size in a 32-bit Windows program? 4 bytes? being the word 8?

b) Why is var_4 set to -4? Why not start, say, 0?

c) The standard procedure for defining ints in c, though

var_x = dword ptr y?

thanks

+1
source share
3 answers

a. Unsigned DWORD, 32 bits: see here (old name, MS started using it when Windows was 16-bit).

b. the top of the stack (dword ptr 0) is occupied by the return address

. y . , dword ptr , " ".

+2

.

  • : 2
  • dword: 4
  • qword: 8

- . Win16, 2 .

. . 0..3 - . < 0 - , a >= 4 - . . ASM - .

. ASM . , .

+1

(a) A dword - , 32-.

(b) , . ( "Base" IA-land.) , err, base, pointer , . , , , "" .

(c) , Intel , , , 8-, 16 - 32- 1 . ia32, 2 , off-beat . , ...


1. 16- 32- , 16- 32- .
2. IA32 AT & T Format .

0

All Articles