Win32 C structure and Asm 
Author Message
 Win32 C structure and Asm

Hi!

I want to use the Win32 CreateProcessA Function. The Structure
StartUpInfo is needed for this. The Win32ApiRef says:

typedef struct _STARTUPINFO { // si
    DWORD   cb;
    LPTSTR  lpReserved;
    LPTSTR  lpDesktop;
    LPTSTR  lpTitle;
    DWORD   dwX;
    DWORD   dwY;
    DWORD   dwXSize;
    DWORD   dwYSize;
    DWORD   dwXCountChars;
    DWORD   dwYCountChars;
    DWORD   dwFillAttribute;
    DWORD   dwFlags;
    WORD    wShowWindow;
    WORD    cbReserved2;
    LPBYTE  lpReserved2;
    HANDLE  hStdInput;
    HANDLE  hStdOutput;
    HANDLE  hStdError;

Quote:
} STARTUPINFO, *LPSTARTUPINFO;

How is it converted to assembler? How do I access the parts?
(mov eax, [_STARTUPINFO+32] for lpDesktop, or another way?)

thx cu

Adikes

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Thu, 21 Feb 2002 03:00:00 GMT  
 Win32 C structure and Asm

Quote:

> Hi!

> I want to use the Win32 CreateProcessA Function. The Structure
> StartUpInfo is needed for this. The Win32ApiRef says:

> typedef struct _STARTUPINFO { // si
>     DWORD   cb;
>     LPTSTR  lpReserved;
>     LPTSTR  lpDesktop;
>     LPTSTR  lpTitle;
>     DWORD   dwX;
>     DWORD   dwY;
>     DWORD   dwXSize;
>     DWORD   dwYSize;
>     DWORD   dwXCountChars;
>     DWORD   dwYCountChars;
>     DWORD   dwFillAttribute;
>     DWORD   dwFlags;
>     WORD    wShowWindow;
>     WORD    cbReserved2;
>     LPBYTE  lpReserved2;
>     HANDLE  hStdInput;
>     HANDLE  hStdOutput;
>     HANDLE  hStdError;

> } STARTUPINFO, *LPSTARTUPINFO;

> How is it converted to assembler? How do I access the parts?
> (mov eax, [_STARTUPINFO+32] for lpDesktop, or another way?)

> thx cu

> Adikes

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

Using Masm and assuming you've defined types..

LPTSTR typedef PTR BYTE
LPBYTE typedef PTR BYTE
HANDLE typedef DWORD

_STARTUPINFO struct
cb     DWORD   ?
lpReserved  LPTSTR  ?
lpDeskTop   LPTSTR  ?
lpTitle     LPTSTR  ?
dwX         DWORD   ?
dwY         DWORD   ?
dwXSize     DWORD   ?
dwYSize     DWORD   ?
dwXCountChars     DWORD   ?
dwYCountChars     DWORD   ?
dwFillAttribute   DWORD   ?
dwFlags     DWORD   ?
wShowWindow WORD    ?
cbReserved2 WORD    ?
lpReserved2 LPBYTE  ?
hStdInput   HANDLE  ?
hStdOutput  HANDLE  ?
hStdError   HANDLE  ?
_STARTUPINFO ends

STARTUPINFO typedef _STARTUPINFO
LPSTARTUPINFO typedef PTR _STARTUPINFO

.data
sinfo STARTUPINFO <>
pinfo PROCESSINFO <>
command BYTE "nmake",0

.code
invoke ZeroMemory, addr sinfo, sizeof(STARTUPINFO) ; Windows API
function
mov    sinfo.dwFlags, STARTF_USESTDHANDLES
mov    sinfo.lpTitle, offset my_title_string
...

invoke CreateProcess, NULL, addr command, NULL, NULL, TRUE,
DETACHED_PROCESS, NULL, NULL,
                addr sinfo, addr pinfo



Thu, 21 Feb 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Win32 C structure and Asm

2. Win32 asm/Linux asm newsgroups?

3. converting win16 asm to win32 asm

4. Win32 asm/Linux asm newsgroups?

5. conflict between CS-PICK and control structure checking

6. to CS: or not to CS: in F-PC assembler

7. huge data structures, {APL} and Win32

8. filling a structure form a win32 function

9. Win32 and the MENUITEMINFO structure

10. windll and structure passing to Win32 API function

11. Accessing Structures from asm

12. Using C/C++ structure in asm...

 

 
Powered by phpBB® Forum Software