;## INCLUDED LIBRARIES ####################################################

include    \masm32\include\windows.inc

include    \masm32\include\user32.inc
include    \masm32\include\kernel32.inc
include    \masm32\include\gdi32.inc
include    \masm32\include\shell32.inc
include    \masm32\include\comctl32.inc
include    \masm32\include\comdlg32.inc
include    \masm32\include\oleaut32.inc
include    \masm32\include\winmm.inc
include    \masm32\include\advapi32.inc
include    win32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\shell32.lib
includelib \masm32\lib\comctl32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\oleaut32.lib
includelib \masm32\lib\winmm.lib
includelib \masm32\lib\advapi32.lib
includelib win32.lib

;## MACROS ################################################################

m2m MACRO M1:REQ, M2:REQ
   push M2
   pop M1
ENDM

szText MACRO Name:REQ, Text:VARARG
    LOCAL lbl
    jmp lbl
        Name db Text,0
    lbl:
ENDM
    
return MACRO arg:REQ
    mov eax, arg
    ret
ENDM

get MACRO hMemory:REQ, iByte:REQ
    push ebx
    mov ebx, hMemory
    add ebx, iByte
    mov al,BYTE PTR [ebx]
    pop ebx
ENDM

put MACRO hMemory:REQ, iByte:REQ
    push ebx
    mov ebx, hMemory
    add ebx, iByte
    mov BYTE PTR [ebx], al
    pop ebx
ENDM

CopyMemory MACRO cmDest:REQ, cmSource:REQ, cmSize:REQ
    pushad
    cld
    mov edi, cmDest
    mov esi, cmSource
    mov ecx, cmSize
    shr ecx, 2
    rep movsd

    mov ecx, cmSize
    and ecx, 3
    rep movsb
    popad
ENDM

Power MACRO Exponent:REQ
    push ebx
    push ecx
    mov ebx, eax
    mov eax, 1
    mov ecx, Exponent
    Power_M_Loop:
        mul ebx
    loop Power_M_Loop
    pop ecx
    pop ebx
ENDM

iPower MACRO Exponent:REQ
    push ebx
    push ecx
    mov ebx, eax
    mov eax, 1
    mov ecx, Exponent
    iPower_M_Loop:
        imul ebx
    loop iPower_M_Loop
    pop ecx
    pop ebx
ENDM

LoadVxD MACRO ADDR_VxDName:REQ
    invoke CreateFile, ADDR_VxDName,
                       0, 0, 0, 0,
                       FILE_FLAG_DELETE_ON_CLOSE,
                       0
    .if eax == -1
        xor eax, eax
    .else
        mov eax, TRUE
    .endif
ENDM

UnloadVxD MACRO VxDHandle:REQ
    invoke CloseHandle, VxDHandle
ENDM

;## PROTOTYPES ############################################################

;## MODULES ###############################################################

;##########################################################################