I know this is old but this is completely relevant to my issue. So basically I have followed this little guide and have found myself the same two functions but for inventory items. I was able to call the function that returns the # of items without issue (on my first try even, lol) but I am having a hell of a time trying to grab the items base address by index.
Basically this is what I found:
Code:
00492ADA /$ 55 PUSH EBP
00492ADB |. 8BEC MOV EBP,ESP
00492ADD |. 83EC 1C SUB ESP,0x1C
00492AE0 |. 53 PUSH EBX
00492AE1 |. 56 PUSH ESI
00492AE2 |. 8BF1 MOV ESI,ECX
00492AE4 |. 57 PUSH EDI
00492AE5 |. 8975 F4 MOV DWORD PTR SS:[EBP-0xC],ESI
00492AE8 |. 8D9E 10100000 LEA EBX,DWORD PTR DS:[ESI+0x1010]
00492AEE |. 53 PUSH EBX
00492AEF |. 8D4B 10 LEA ECX,DWORD PTR DS:[EBX+0x10]
00492AF2 |. E8 D0CDFEFF CALL Conquer.0047F8C7
00492AF7 |. 8365 FC 00 AND DWORD PTR SS:[EBP-0x4],0x0
00492AFB |. 8945 F8 MOV DWORD PTR SS:[EBP-0x8],EAX
00492AFE |. 85C0 TEST EAX,EAX
00492B00 |. 7E 33 JLE SHORT Conquer.00492B35
00492B02 |> 8BF3 /MOV ESI,EBX
00492B04 |. 8D7D E4 |LEA EDI,DWORD PTR SS:[EBP-0x1C]
00492B07 |. A5 |MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
00492B08 |. A5 |MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
00492B09 |. FF75 FC |PUSH DWORD PTR SS:[EBP-0x4]
00492B0C |. 8D4D E4 |LEA ECX,DWORD PTR SS:[EBP-0x1C]
00492B0F |. A5 |MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
00492B10 |. A5 |MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
00492B11 |. E8 19CE0000 |CALL Conquer.0049F92F
00492B16 |. 8B45 E4 |MOV EAX,DWORD PTR SS:[EBP-0x1C]
00492B19 |. 8B00 |MOV EAX,DWORD PTR DS:[EAX]
Where this section is returning the # of items:
Code:
00492AE8 |. 8D9E 10100000 LEA EBX,DWORD PTR DS:[ESI+0x1010]
00492AEE |. 53 PUSH EBX
00492AEF |. 8D4B 10 LEA ECX,DWORD PTR DS:[EBX+0x10]
00492AF2 |. E8 D0CDFEFF CALL Conquer.0047F8C7
And to call that from my DLL I'm using (Works just fine, naming conventions probably suck):
Code:
MOV EBX, Properties::Inventory_Base_address
PUSH EBX
MOV ECX, Properties::Inventory_Sub_address
CALL Properties::Inventory_Count_Function_address
This next part is the one that I can't seem to get right, getting the Item by its index:
Code:
00492B04 |. 8D7D E4 |LEA EDI,DWORD PTR SS:[EBP-0x1C]
00492B07 |. A5 |MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
00492B08 |. A5 |MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
00492B09 |. FF75 FC |PUSH DWORD PTR SS:[EBP-0x4]
00492B0C |. 8D4D E4 |LEA ECX,DWORD PTR SS:[EBP-0x1C]
00492B0F |. A5 |MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
00492B10 |. A5 |MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
00492B11 |. E8 19CE0000 |CALL Conquer.0049F92F
1. It moves into EDI the Inventory_Base_address (as I have it defined)
2. Then populates the stack with a few pointers to different parts of the collection in memory.
3. Pushes the index to the stack.
4. Sets ECX to be equal to the address of the first value set in 2.
5. Few more points to different parts of the collection.
6. Calls the function
7. EAX contains the pointer to the specified item index.
With that, I have tried a few different interations. But this one seems to crash the latest
Code:
MOV EBP,ESP
SUB ESP, 0x1C
PUSH EDI
MOV ESI, Properties::Inventory_Base_address
LEA EDI,DWORD PTR SS:[EBP-0x1C]
MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
PUSH TIndex
LEA ECX, DWORD PTR SS:[EBP-0x1C]
MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
CALL Properties::Inventory_Deque_Function_address
MOV _TTReturn, EAX
POP EDI
POP ESI
Following through with Olly makes it seem like I'm so close but just can't quite figure out why it is still crashing.
I have been able to call many other functions from my DLL without issue(after struggling through issues) and I can't seem to figure this one out. I would appreciate any help that you can provide! I'm just using a private server that I have setup (p 5065) to use as a means to learn.
Edit:
I'm a tard. The reason it was crashing was totally un-related to what I was trying to accomplish. Guess I just needed to step away and come back to it. For the curious, its literally just:
Code:
MOV ESI, Properties::Inventory_Base_address
LEA EDI,DWORD PTR SS:[EBP-0x1C]
MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
PUSH TIndex
LEA ECX, DWORD PTR SS:[EBP-0x1C]
MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI]
CALL Properties::Inventory_Deque_Function_address
MOV _TTReturn, EAX