flat assembler
Message board for the users of flat assembler.
Index
> Windows > REG_BINARY structure... |
Author |
|
MHajduk 27 Aug 2010, 20:34
Try something like this:
Code: invoke RegSetValueEx, [phkResult], RegValName, 0, REG_BINARY, <Address of data buffer>, <Length of the data> test eax, eax jnz .failed (...) RegValName db 'Framewindow', 0 |
|||
27 Aug 2010, 20:34 |
|
semiono 27 Aug 2010, 20:38
Is this valid the part of buffer format — invoke wsprintf,@x,'%d',eax ?
OK! I try it. |
|||
27 Aug 2010, 20:38 |
|
semiono 28 Aug 2010, 10:45
Code: invoke GetSystemMetrics,SM_CXSCREEN ;invoke wsprintf,zzzz,'%u',eax invoke wsprintf,zzzz,'%x',eax ... invoke RegSetValueEx,[phkResult],'Framewindow',NULL,REG_BINARY,zzzz,4 reg [34383000] 480h reg [31313500] 1152 This should be little endian direction... http://msdn.microsoft.com/en-us/library/ms724884(v=VS.85).aspx "REG_BINARY | Binary data in any form." nothing about :\ How possible to format the buffer? -- invoke RegSetValueEx,[phkResult],'Framewindow',NULL,REG_BINARY,eax,4 |
|||
28 Aug 2010, 10:45 |
|
MHajduk 28 Aug 2010, 10:53
semiono wrote: This should be little endian direction... (...) Code: mov eax, 0x01020304 bswap eax |
|||
28 Aug 2010, 10:53 |
|
semiono 28 Aug 2010, 20:41
I've do it! Yes!
Code: section '.code' executable start: xor eax,eax mov eax,18h mov [i],eax ; task bar size top invoke GetSystemMetrics,SM_CXSCREEN mov [x],eax invoke GetSystemMetrics,SM_CYSCREEN sub eax,52 ; ommit task bar size + bottom some size cosmetic mov [y],eax invoke RegCreateKeyEx,HKCU,'Software\Software\Steinberg\Cubase SX',NULL,NULL,REGN,KEY_WRITE,NULL,phkResult,NULL invoke RegSetValueEx,[phkResult],'Framewindow',NULL,REG_BINARY,!,20 invoke RegCloseKey,[phkResult] exit: invoke ExitProcess,NULL section '.data' readable writable HKCU = HKEY_CURRENT_USER REGN = REG_OPTION_NON_VOLATILE ! dq NULL i dd ? x dd ? y dd ? phkResult dd ? in registry 00 00 00 00 00 00 00 00 18 00 00 00 80 04 00 00 2c 03 00 00 (1152x812) Please, examine me if code could has been hidden errors posible or code is not clean? -------------------->8-- Big thanks, MHajduk! to following post > "mov dword [i]" ))) i'm lame! Last edited by semiono on 29 Aug 2010, 10:25; edited 8 times in total |
|||
28 Aug 2010, 20:41 |
|
MHajduk 28 Aug 2010, 21:39
semiono, checking return code (stored in the eax register) of the WinAPI functions is a good programming practice.
I've made some minor corrections of your code Code: format PE console include 'win32ax.inc' section '.code' code executable start: mov dword [i], 18h ; task bar size top invoke GetSystemMetrics, SM_CXSCREEN test eax, eax jz failed mov [x], eax invoke GetSystemMetrics, SM_CYSCREEN test eax, eax jz failed sub eax, 52 ; omit task bar size + some cosmetic of the bottom size mov [y], eax invoke RegCreateKeyEx, HKCU, 'Software\Software\Steinberg\Cubase SX', NULL, NULL, REGN, KEY_WRITE,NULL, phkResult, NULL test eax, eax jnz failed invoke RegSetValueEx, [phkResult], 'Framewindow', NULL, REG_BINARY, !, 20 test eax, eax jnz failed invoke RegCloseKey, [phkResult] test eax, eax jnz failed jmp exit failed: stdcall ShowLastError, HWND_DESKTOP exit: invoke ExitProcess, NULL ; This procedure shows error messages in a human-readable form. ; proc ShowLastError, hwnd locals Buffer dd ? endl push ebx invoke GetLastError lea ebx, [Buffer] invoke FormatMessage, FORMAT_MESSAGE_ALLOCATE_BUFFER + FORMAT_MESSAGE_FROM_SYSTEM, 0, eax, LANG_NEUTRAL, ebx, 0, 0 invoke MessageBox, [hwnd], [Buffer], NULL, MB_ICONERROR + MB_OK invoke LocalFree, [Buffer] pop ebx ret endp section '.data' data readable writable HKCU = HKEY_CURRENT_USER REGN = REG_OPTION_NON_VOLATILE ! dq NULL i dd ? x dd ? y dd ? phkResult dd ? .end start |
|||
28 Aug 2010, 21:39 |
|
semiono 01 Sep 2010, 21:13
My first macro!
Code: macro rc r1,r2,r3,r4 {invoke RegSetValueEx,[phkResult],r1,NULL,r2,r3,r4} rc 'Code',REG_SZ,'59F0D04B31ADF0026C08E6041FD477284DA2910FDC11CDEB',48 rc 'Current',REG_SZ,'Semiono',7 rc 'Name',REG_DWORD,@00000001,4 ; @00000001 dd 0x00000001 ))) |
|||
01 Sep 2010, 21:13 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.