能力值:
( LV2,RANK:10 )
2 楼
按求助,按到原创了.
自己顶一下,请高手帮忙看看啊!
能力值:
(RANK:350 )
3 楼
你参数有问题,
DWORD GetPrivateProfileString(
LPCTSTR lpAppName, // points to section name
LPCTSTR lpKeyName, // points to key name
LPCTSTR lpDefault, // points to default string
LPTSTR lpReturnedString, // points to destination buffer
DWORD nSize, // size of destination buffer
LPCTSTR lpFileName // points to initialization filename
);
汇编形式:
push lpFileName
push nSize
push lpReturnedString
push lpDefault
push lpKeyName
push lpAppName
call GetPrivateProfileString 你的:
0055232B 6A 40 push 40
0055232D 68 C0235500 push 005523C0
00552332 68 0A235500 push 0055230A ; ASCII ".\Gms\User"
00552337 68 15235500 push 00552315 ; ASCII "FilesPath"
0055233C 68 1F235500 push 0055231F ; ASCII "Program"
00552341 68 FF225500 push 005522FF ; ASCII 09,".\Pds.ini"
00552346 - FF25 34534F00 jmp dword ptr [<&kernel32.GetPrivate>; kernel32.GetPrivateProfileStringA
能力值:
( LV2,RANK:10 )
4 楼
GetPrivateProfileStringA的参数如下:
lpApplicationName String [0055231F=(ASCII "Program")]
lpKeyName String [00552315=(ASCII "FilesPath")]
lpDefault String [0055230A=(ASCII ".\Gms\User")]
lpReturnedString String [5522C0]
nSize Long [40]
lpFileName [00552300=(ASCII ".\Pds.ini")]
我第一次就是这样,然后在552346处设断
0055232B 68 00235500 push 00552300 ; ASCII ".\Pds.ini"
00552330 6A 40 push 40
00552332 68 C0235500 push 005523C0
00552337 68 0A235500 push 0055230A ; ASCII ".\Gms\User"
0055233C 68 15235500 push 00552315 ; ASCII "FilesPath"
00552341 68 1F235500 push 0055231F ; ASCII "Program"
00552346 - FF25 34534F00 jmp dword ptr [<&kernel32.GetPrivate>; kernel32.GetPrivateProfileStringA
断下后,INI文件名变成那样,每个参数都不对,我的错在哪?
0012FF8C 0055231F /CALL 到 GetPrivateProfileStringA
0012FF90 00552315 |Section = "FilesPath"
0012FF94 0055230A |Key = ".\Gms\User"
0012FF98 005523C0 |Default = ""
0012FF9C 00000040 |ReturnBuffer = 00000040
0012FFA0 00552300 |BufSize = 552300 (5579520.)
0012FFA4 7C930738 \IniFileName = ""FF,"",FF,"",FF,"",FF,"]?,96,"|f?,96,"|3?,8B,"?,8B,"蚜?,02,"?,AB,"",8B,"?,83,"?,03,"螵閨",FF,"",FF,"",FF,"",90,"",90,"",90,"",90,"",90,"",8B,"",FF,"U",8B,"?,83,"?,1C,"SVW3劭",A0,"?,99,"|?,80,"?,99,"|",83,"M?,FF,"岴"...
能力值:
(RANK:350 )
5 楼
好像是你OD堆栈提示有问题,正确:
/CALL 到 GetPrivateProfileStringA
0012FF8C 0055231F |Section
0012FF90 00552315 |Key
0012FF94 0055230A |Default
0012FF98 005523C0 |ReturnBuffer
0012FF9C 00000040 |BufSize
0012FFA0 00552300 \lpFileName
能力值:
( LV2,RANK:10 )
6 楼
问题找到了
00552346 - FF25 34534F00 jmp dword ptr [<&kernel32.GetPrivate>; kernel32.GetPrivateProfileStringA
把上一句改成下面这样就好了.
00552346 FF15 34534F00 call dword ptr [<&kernel32.GetPrivate>; kernel32.GetPrivateProfileStringA
另外GetPrivateProfileStringA函数的返回值不在EAX中吗?我想把返回值送到4f25c3处,因此我在CALL后面有一句
mov dword ptr ds:[4F25C3],eax
并在这一句上设断,查看EAX的值为OC,但在字符缓冲区的字符串为"I:\Gms\User\"这是怎么了?
能力值:
( LV2,RANK:10 )
7 楼
EAX中的OC刚好是这个字符串的长度,是不是返回的长度呢?
能力值:
( LV9,RANK:375 )
8 楼
你可以查下msdn
Return Value
The return value is the number of characters copied to the buffer, not including the terminating null character.
这个函数返回的就是字符串的长度
函数的参数中不是有个 LPTSTR lpReturnedString, // points to destination buffer
字符串是放在那里面的