- This topic has 142 replies, 8 voices, and was last updated 10 years ago by Admin.
-
AuthorPosts
-
July 22, 2013 at 1:18 am #186077ChikeMember
Oh wow return code has meaning, who would have thought.
To figure it out all you need is to google the function name it the meaning of each return code will be in the documentention.
Now back to teh code and examine carefullt those return codes.
And here’s another jint for you” you may need to call GetLastError.July 22, 2013 at 2:48 am #186076cyberpunkMemberChike,
I read up on the CloseHandle function and found out a zero is not a good thing afterall lol. so that is what return codes are for lol.
I am trying to find out what the error is now, It looks like I need to figure out how to use Err.LastDLLError now.
even after following examples all i get from Err.LastDLLError is a zero, which doesn’t tell me as much as I was hoping lolI just wanted to say all the help is appreciated, I know it is frustrating dealing with someone that should have the basics down before being at this point.
July 22, 2013 at 3:20 am #186075ChikeMemberUse a call to windoe’s GetLastError, that will always work.
What is CloseHandle and VirtualFreeEx functions decleration?
BTW the value of result is valid after making the call, meaning when the debugger is line after, when the yellow arrow is pointing on the line it has not been excecuted yet.July 22, 2013 at 3:37 am #186074cyberpunkMemberyeah, it took me a while to figure out it was trigger after it passed the line. I am definately getting a 1 on all CloseHandle runthroughs. The zero is on the VirtualFreeEx, and yes I checked that documentation and low and behold a zero there is not a good thing either. So, clearly this is the problem point, thanks chike for letting see the troubleshooting process play out. I see how these tools play together. At first runthrough in the VirtualFreeEx docs I am wondering if I might want to think about the MEM_DECOMMIT instead? After reading it looks like MEM DECOMMIT would possibly make it worse lol. MEM_RELEASE certainly appears to be the right way to go. I will google some more.
GetLastError is not declared. I did see on MSDN that VB is suppose to use the Err.LastDLLError property now, but I certainly could be wrong, but they printed it in bold on the CloseHandle Doc page. the example i found used a MessageBox to display the last error code using the Err.LastDLLError property. it returns a zero as well, which doesn’t tell me what the error is. bummer.
So all I know for certain is the thing is not closing the process. again bummer.
July 22, 2013 at 4:09 am #186073ChikeMemberIt’s weird CloseHandle returns an error.
Do I need to beg you for functions declerations?Yes you need to declare it dllomport, something like
Declare Auto Function GetLastError lib "kernel32.dll" () As ULong
Here, now GetLastError is declared.
July 22, 2013 at 4:21 am #186072cyberpunkMemberAh lol
I did see that request and truly did forget about it, lolANd, No, I edited that out or the original post. It is fine. it is VirtualFreeEx thans returns a zero
Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As IntPtr
Declare Function VirtualFreeEx Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As Integer, ByVal dwFreeType As Integer) As Integer
Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As LV_ITEMA, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As LV_ITEMA, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As IntegerJuly 22, 2013 at 4:41 am #186071ChikeMember@ManicMike wrote:
ANd, No, I edited that out or the original post. It is fine. it is VirtualFreeEx thans returns a zero
for that I would write code like this
if VirtualFreeEx(..) = 0 then
result = GetLastError()
endif
That would get you closer to what you are looking for.
Is all the code originaly from autopilot code, or someone else?
July 22, 2013 at 4:54 am #186070cyberpunkMemberYeah, it is autopilot’s code originally, but I have messed with it some, but very little. But any obvious errors are certainly my contribution lol
Working on getting your last suggestion working now, thanks againJuly 22, 2013 at 4:57 am #186069ChikeMemberNo it’s not that of an obviouse error.
Well it depends who you ask, but it is hidden in a trickt way.July 22, 2013 at 5:26 am #186068cyberpunkMemberI got some 20digit number as a return value….Not sure I have this working right.
It consistently returns the same 20 digit value too, i am starting to wonder if this is the starting address of the memory being used, but does that help me? lolJuly 22, 2013 at 5:51 am #186067ChikeMember@ManicMike wrote:
I got some 20digit number as a return value….Not sure I have this working right
From GetLastError using this code?
Declare Auto Function GetLastError lib "kernel32.dll" () As ULong
You should get onlt 2 digits.
The return code is only meaningful it there was a call that failed and before making any other call.July 22, 2013 at 5:53 am #186066ChikeMember@ManicMike wrote:
i am starting to wonder if this is the starting address of the memory being used, but does that help me? lol
Of both ponters? And if it is how the @#$% did you build the user name?
July 22, 2013 at 5:59 am #186065cyberpunkMemberOk, let me explain how I got the GetLastError to work first and how I used it.
I first started out with your examples, but there were some expected arguments and I ad libbed with help from the IDE. It suggested I import the System.Runtime.interopservices and then it gave an error on the DLLImport itself but led me to suspect i could comment it out and run with your Declare statement and it all seemed error free. So I put the If statement in your final post right after the VirtualFreeEx statement and as I go through and VirtualFreeEx gets its 0 it runs through the If statement and returns this 20 digit number after it processes the GetLastError statement
July 22, 2013 at 6:02 am #186064cyberpunkMemberlol…Chike, it was about three weeks of screwing around with autopilots functions in loco’s adminbot and voila! lol
July 22, 2013 at 6:06 am #186063cyberpunkMemberLet me also add that I am doing my breakpoint using the Status sub assuming both subs have the same issue. just the Status is the first place it hits and seemed like the logical breakpoint. I just set another breakpoint in the other name sub with the same conditional statement and am getting the same 20 digit number
I forgot to add another ad lib that might explain the 20 digit number. I edited this part of the if statement
if VirtualFreeEx(..) = 0 then
result = GetLastError()
endifto
if result = 0 then
result = GetLastError()
endifthat seemed logical but suddenly is making me wonder if that is why it is acting weirder than you expected
And yes directly following the VirtualFreeEx statement right before the closeHandle
-
AuthorPosts
Related
- You must be logged in to reply to this topic.