Skip to content

Paltalk Timer

Viewing 15 posts - 76 through 90 (of 143 total)
  • Author
    Posts
  • #186062
    Chike
    Member

    As long it’s after VirtualFreeEx

    #186061
    Chike
    Member

    @ManicMike wrote:

    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()
    endif

    to

    if result = 0 then
    result = GetLastError()
    endif

    that 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

    No that does not change anything
    If you break before the call to GetLastError and step over it do you see reult change? (value in red)

    #186060
    cyberpunk
    Member

    The break is on the VirtualFreeEx line so it is before GetLastError, I do see the values change from 0 to this 20 digit number, I can go back even further and get some 1’s before the 0, but the Close handle returns a 1

    #186059
    cyberpunk
    Member

    Chike, this process has taught me a great deal. I appreciate the help. If it is late where you are it can keep til later. but i am going to be up myself

    #186058
    Chike
    Member

    Try this maybe


    Imports System.Runtime.InteropServices
    ...
    result = Marshal.GetLastWin32Error()
    #186057
    cyberpunk
    Member

    That returns value 87. Cool, I will have to learn what the difference is between these two methods. Does 87 tell you anything more about what the issue is? I see no information on what the code might mean in the documentation for VirtualFreeEx

    #186056
    Departure
    Member

    Hmm lets see…

    you get an error on this? with error code 87?

    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE)

    MSDN says this..

    ERROR_INVALID_PARAMETER
    87 (0x57)
    The parameter is incorrect.

    You have declared the function like this…

    Declare Function VirtualFreeEx Lib “kernel32” (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As Integer, ByVal dwFreeType As Integer) As Integer

    You created variables like this…

    Dim pHandle As Integer
    Dim pStrBufferMemory As Integer
    Dim pMyItemMemory As Integer

    MSDN says this about VirtualFreeEx…

    Parameters
    hProcess [in]
    A handle to a process. The function frees memory within the virtual address space of the process.
    The handle must have the PROCESS_VM_OPERATION access right. For more information, see Process Security and Access Rights.
    lpAddress [in]
    A pointer to the starting address of the region of memory to be freed.
    If the dwFreeType parameter is MEM_RELEASE, lpAddress must be the base address returned by the VirtualAllocEx function when the region is reserved.
    dwSize [in]
    The size of the region of memory to free, in bytes.

    hmm Parameter lpAddress [in] requires a pointer, pStrBufferMemory As Integer and pMyItemMemory As Integer seems you are passing an integer value and not a pointer?

    I could be completely wrong here as I haven’t personally used this code or looked through it properly.

    #186055
    cyberpunk
    Member

    Link didn’t work, trying to locate the URL the old fashioned way through google now, clearly you would not have posted a link unless it was relevant, Damn MSDN too, I was on MSDN for the documentation, I didn’t see anything about this, I found one obscure reference to this function returning 87 refers to non aligned pages or something, but that was the only thing I came up with, still googling

    #186054
    cyberpunk
    Member

    I see why you say that…You laid that out very well. But when I hover over the pMyItemMemory is does say it is being declared as a IntPtr (after I edited it to do so) though and has a ten digit value set for it during codewalks, i am assuming that is the lpAddress

    It returns 87 whether it is declared as Integer or IntPtr

    #186053
    Departure
    Member
    #186052
    cyberpunk
    Member

    @Departure wrote:

    i added the .aspx too and it still came out as Page not found error, but I suspect your post gave me the particulars. I am googling now to see what I can found out, Just all the other functions autopilot is using in his syslistview module seem to work the same way. Well, it is not like we use his functions once a second either. so they might have the same issue. But IntPtr made no change.

    I did a search for ms681382 and NOW I see what you where linking me too. a list of Error Codes! Awesome! lol Bookmarked for future quick access. no doubt I will use this a lot.

    #186051
    Chike
    Member

    @Departure wrote:

    hmm Parameter lpAddress [in] requires a pointer, pStrBufferMemory As Integer and pMyItemMemory As Integer seems you are passing an integer value and not a pointer?

    I could be completely wrong here as I haven’t personally used this code or looked through it properly.

    The ponters should be declared IntPtr but this does not make a difference in 32bit winfows, and it didn’t bother the write/read memory functions, so why whould it be different?

    If VirtualAllocEx returned a value greater than 32bit it would raise an exception in runtimewhen trying to assign it to an integer.

    So what other parameters are there that can turn to be a bad parameter?

    @ManicMike wrote:

    I did a search for ms681382 and NOW I see what you where linking me too. a list of Error Codes! Awesome! lol Bookmarked for future quick access. no doubt I will use this a lot.

    Yeah I did that too back in the days, now my bokmarks list is so long I just coogle “windows error codes”
    So now that you have all the information you need, chop chop.

    #186050
    cyberpunk
    Member

    lol @ chop chop

    I get the issue is that it is not releasing the memory, but from what I can tell I am giving it the proper parameters. clearly I am not or am missing something. The Error message indicates that it doesn’t like the parameter I am giving it, but lol it is all I got to give it. I will try to think outside the box. I will study up on the functions involved and see what pops up, I have no issue with you guys holding back on me.

    Just to verify what you said about the IntPtr, it did not alter the symptoms one bit.

    I will post back if I need another hint. I can see there more than a few functions documentation that I need to read on this.

    I do appreciate the lesson in how to properly troubleshoot code issues. I feel silly now looking back at how I didn’t see the value of setting a breakpoint, just didn’t occur to me to hover over variables. That really does make troubleshooting code very logical.

    #186049
    Chike
    Member

    @ManicMike wrote:

    I get the issue is that it is not releasing the memory, but from what I can tell I am giving it the proper parameters. clearly I am not or am missing something.

    Those stupid programmers at microsoft i’m telling ya.
    “from what I can tell”…
    Lets for a moment assume them microsoft programmers are not THAT stupid, and there is/are bad parameter(s).
    We (I) already excluded the option it’s the pointers, what else we got?
    1. Process handle, but closehandle as well as VirtualAllocEx don’t fail.
    2. Size, but you pass 0 which is in comliance with the documentation and the type of free you want to make.
    3. Free type, but that looks to be what it should according to documentation, or is it? (damn big hint)

    Not everything is what it “looks” to be, you have to know how to look.

    #186048
    cyberpunk
    Member

    Damn good hint Chike

    Now getting a return of 1

    Making changes to all subs and going to test it out. and while testing I will be googling why some Const have an S at the end. I took a guess and added it though the example I saw didn’t have it. Seemed logical to add the S since the MEM_COMMIT had it. I have learned a great deal. Thanks guys.

    Final Update to this issue:
    Issue Resolved thanks to Chike’s smacking me over the head with a clue club.

    Good call Chike.

Viewing 15 posts - 76 through 90 (of 143 total)
  • You must be logged in to reply to this topic.