flat assembler
Message board for the users of flat assembler.
Index
> Windows > TCHAR access in Windows structures ... |
Author |
|
shutdownall 23 May 2012, 15:51
Sorry, need some help, fighting with Windows and following structure;
typedef struct _DEV_BROADCAST_PORT { DWORD dbcp_size; DWORD dbcp_devicetype; DWORD dbcp_reserved; TCHAR dbcp_name[1]; } DEV_BROADCAST_PORT, *PDEV_BROADCAST_PORT; http://msdn.microsoft.com/en-us/library/windows/desktop/aa363248%28v=vs.85%29.aspx How can I access dbcp_name (show the name in a message box) ? Quote:
Tried to define this way: Code: struct DEV_BROADCAST_PORT dbcp_size dd ? dbcp_devicetype dd ? dbcp_reserved dd ? dbcp_name dd ? ends mov ebx,[lparam] virtual at ebx dbp DEV_BROADCAST_PORT end virtual invoke MessageBox,[hwnd],[dbp.dbcp_name],_caption,MB_ICONERROR+MB_OK But this kills my application. Other "definitions" I tried are not accepted by FASM. One additional hint: Quote:
So this seems to be an error in the documentation. Thanks. |
|||
23 May 2012, 15:51 |
|
AsmGuru62 23 May 2012, 16:02
Maybe this way:
Code: mov ebx,[lparam] lea eax, [ebx + DEV_BROADCAST_PORT.dbcp_name] invoke MessageBox,[hwnd],eax,_caption,MB_ICONERROR+MB_OK |
|||
23 May 2012, 16:02 |
|
AsmGuru62 23 May 2012, 21:11
DEV_BROADCAST_PORT.dbcp_name is actually at offset of 12 bytes, so it should have worked too.
|
|||
23 May 2012, 21:11 |
|
shutdownall 23 May 2012, 21:35
Yes I know, don't like to use lea when I can use add instead.
Anyway strange syntax to use a structure for non structured data (variable length of structure content). |
|||
23 May 2012, 21:35 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.