-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAutoCmdLineIni.asm
88 lines (62 loc) · 2.89 KB
/
AutoCmdLineIni.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
include advapi32.inc
includelib advapi32.lib
IniGetModuleCmdLine PROTO :DWORD, :DWORD, :DWORD
IniSetModuleCmdLine PROTO :DWORD, :DWORD, :DWORD
.CONST
.DATA
.DATA?
.CODE
IniGetModuleCmdLine PROC USES EBX lpszModuleFilename:DWORD, lpszCommandLine:DWORD, lpdwRememberOption:DWORD
LOCAL szIniCommandLineString[MAX_PATH+2]:BYTE
LOCAL lenModuleFilename:DWORD
Invoke lstrlen, Addr DebugFilenameMD5
.IF eax == 0 ; havnt got the hash of this module name yet, so do it now
Invoke AutoCmdLineCreateHash, lpszModuleFilename, Addr DebugFilenameMD5
Invoke lstrcpy, Addr szLogMsg, Addr szIniGetModuleCmdLine
Invoke lstrcat, Addr szLogMsg, Addr DebugFilenameMD5
Invoke lstrcat, Addr szLogMsg, Addr szCRLF
Invoke GuiAddLogMessage, Addr szLogMsg
IFDEF DEBUG32
PrintText 'IniGetModuleCmdLine'
PrintString DebugFilenameMD5
ENDIF
.ENDIF
Invoke GetPrivateProfileString, Addr DebugFilenameMD5, Addr szIniCmdLine, Addr szColon, Addr szIniCommandLineString, SIZEOF szIniCommandLineString, Addr AutoCmdLineIni
.IF eax == 0 || eax == 1 ; just got nothing or the colon and nothing else, so no command line stored for this
mov ebx, lpszCommandLine
mov byte ptr [ebx], 0
mov eax, FALSE
.ELSE
Invoke GetPrivateProfileInt, Addr DebugFilenameMD5, Addr szIniRemember, 0, Addr AutoCmdLineIni
mov ebx, lpdwRememberOption
mov [ebx], eax
Invoke lstrcpy, lpszCommandLine, Addr szQuote
Invoke lstrcat, lpszCommandLine, Addr szIniCommandLineString
Invoke lstrcat, lpszCommandLine, Addr szQuote
;Invoke lstrcpy, lpszCommandLine, Addr szIniCommandLineString
mov eax, TRUE
.ENDIF
ret
IniGetModuleCmdLine endp
IniSetModuleCmdLine PROC USES EBX lpszModuleFilename:DWORD, lpszCommandLine:DWORD, dwRememberOption:DWORD
LOCAL szIniCommandLineString[MAX_PATH]:BYTE
LOCAL lenModuleFilename:DWORD
Invoke AutoCmdLineCreateHash, lpszModuleFilename, Addr DebugFilenameMD5
Invoke lstrcpy, Addr szLogMsg, Addr szIniSetModuleCmdLine
Invoke lstrcat, Addr szLogMsg, Addr DebugFilenameMD5
Invoke lstrcat, Addr szLogMsg, Addr szSpace
Invoke lstrcat, Addr szLogMsg, lpszModuleFilename
Invoke lstrcat, Addr szLogMsg, Addr szCRLF
Invoke GuiAddLogMessage, Addr szLogMsg
IFDEF DEBUG32
PrintText 'IniSetModuleCmdLine'
PrintString DebugFilenameMD5
ENDIF
Invoke WritePrivateProfileString, Addr DebugFilenameMD5, Addr szIniCmdLine, lpszCommandLine, Addr AutoCmdLineIni
.IF dwRememberOption == 0
Invoke WritePrivateProfileString, Addr DebugFilenameMD5, Addr szIniRemember, Addr szZero, Addr AutoCmdLineIni
.ELSE
Invoke WritePrivateProfileString, Addr DebugFilenameMD5, Addr szIniRemember, Addr szOne, Addr AutoCmdLineIni
.ENDIF
ret
IniSetModuleCmdLine endp