flat assembler
Message board for the users of flat assembler.
Index
> Windows > WritePrivateProfileString not work!, whats wrong? |
Author |
|
baldr 05 Jan 2013, 20:22
vagination,
When in doubt, RTFM. MSDN wrote: If the lpFileName parameter does not contain a full path and file name for the file, WritePrivateProfileString searches the Windows directory for the file. If the file does not exist, this function creates the file in the Windows directory. |
|||
05 Jan 2013, 20:22 |
|
vagination 05 Jan 2013, 23:52
Solucion using GetFullPathNameA.
GetPrivateProfileString confused me because it does not need the full path. Code: Code: Format PE GUI Entry start include "win32ax.inc" section '.data' data readable writeable Seccion db 'Download', 0 Key db 'File', 0 String db 'program.exe',0 Config db "Update.ini",0 Path db 256h DUP (0) section '.text' code readable executable start: push 0 push Path push 256h push Config call [GetFullPathNameA] push Path push String push Key push Seccion call [WritePrivateProfileStringA] push 0 call [ExitProcess] section '.idata' import data readable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL' import kernel32,\ WritePrivateProfileStringA,'WritePrivateProfileStringA',\ ExitProcess,'ExitProcess',\ GetFullPathNameA,'GetFullPathNameA' section '.reloc' fixups data readable discardable Regards. |
|||
05 Jan 2013, 23:52 |
|
baldr 06 Jan 2013, 05:59
vagination,
256h seems too arbitrary, you may use MAX_PATH instead. And those bytes don't have to be initialized. It always makes me curious why somebody would include "win32ax.inc" and not use its features, like enhanced invoke and automatic API imports. Relocations for PE .EXE with default base look suspicious too. |
|||
06 Jan 2013, 05:59 |
|
typedef 06 Jan 2013, 16:02
vagination?
|
|||
06 Jan 2013, 16:02 |
|
vagination 09 Jan 2013, 21:11
typedef: hahahaa ! xD
baldr: Now use MAX_PATH... include "win32ax.inc" , is habit ;P |
|||
09 Jan 2013, 21:11 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.