forum-msg-id-132026-edit

Original date:2018-02-26 05:16:56 Edited by: begin Subject: Re: Need an other phix explanation please

fixed one problem:

make (or insert it in winlib32.ew) new file "w32NtDll.ew" with content of

global constant 
ntdll = registerw32Library("ntdll.dll"), 
    xRtlGetVersion = registerw32Function(ntdll,"RtlGetVersion",{C_POINTER}, C_UINT) 

change function getWinVersion in winlib32.ew. it now will get windows 10 and >

global function getWinVersion() 
    sequence lResult 
    atom lOV 
    atom lResp 
 
    lOV = w32to_memory(0,ID_OSVERSIONINFOEX,0) 
    lResp = w32Func(xGetVersionEx, {lOV}) 
    lResult = repeat(0,10) 
    if lResp = 0 then 
        w32store(lOV, dwOSVersionInfoSize, SIZEOF_OSVERSIONINFOEX) 
        lResp = w32Func(xGetVersionEx, {lOV}) 
    end if 
    lResult[1..4] = peek4s({lOV+4, 4}) 
    if (lResult[1] = 6) and (lResult[2] = 2) then 
        w32release_mem(lOV) 
        lOV = w32to_memory(0,ID_OSVERSIONINFOEX,0) 
        lResp = w32Func(xRtlGetVersion, {lOV}) 
        lResult = repeat(0,9) 
        if lResp = 0 then 
            w32store(lOV, dwOSVersionInfoSize,  SIZEOF_OSVERSIONINFOEX) 
            lResp = w32Func(xRtlGetVersion, {lOV}) 
        end if 
        lResult[1..4] = peek4s({lOV+4, 4}) 
        lResult[3] = 0 
        lResult[5] = "" 
        lResult[6] = w32fetch(lOV,wServicePackMajor) 
        lResult[7] = w32fetch(lOV,wServicePackMinor) 
        lResult[8] = w32fetch(lOV,wSuiteMask) 
        lResult[9] = w32fetch(lOV,wProductType) 
     else 
        lResult[5] = w32peek_string(lOV + 20) 
        lResult[6] = w32fetch(lOV,wServicePackMajor) 
        lResult[7] = w32fetch(lOV,wServicePackMinor) 
        lResult[8] = w32fetch(lOV,wSuiteMask) 
        lResult[9] = w32fetch(lOV,wProductType) 
      end if 
    w32release_mem(lOV) 
    if lResult[1]=10 then 
        lResult[1]=WIN_10 
    elsif lResult[1]=6 then 
        lResult[1]=WIN_VISTA 
    elsif lResult[4] = 0 then 
        lResult[1] = WIN_3_1 
    elsif lResult[4] = 1 then 
        if lResult[2] = 0 then 
            if equal(lResult[5], " C") then 
                lResult[1] = WIN_95_OSR2 
            else 
                lResult[1] = WIN_95 
            end if 
 
        elsif lResult[2] = 10 then 
            if equal(lResult[5], " A") then 
                lResult[1] = WIN_98SE 
            else 
                lResult[1] = WIN_98 
            end if 
        else 
            lResult[1] = WIN_ME 
        end if 
        lResult[3] = and_bits(#FFFF, lResult[3]) 
    else 
        if lResult[2] = 51 then 
            lResult[1] = WIN_NT_3_51 
        elsif lResult[2] = 0 then 
            if lResult[1] = 4 then 
                lResult[1] = WIN_NT_4 
            else 
                lResult[1] = WIN_2000 
            end if 
        elsif lResult[2] = 1 then 
            lResult[1] = WIN_XP 
        else 
            lResult[1] = WIN_UNKNOWN 
        end if 
    end if 
    lResult[2] = lResult[5] 
 
    if lResult[6] = 0 then 
        lResult = lResult[1..3] 
    else 
        lResult = lResult[1..3] & lResult[6..9] 
    end if 
    return lResult 
end function 

now a new problem arises in procedure registerClass( object szClassName ) in winlib32.ew. any program crashes in

    if w32Func( xRegisterClassEx, { wndClassEx } ) = 0 then 
        abortErr( Err_REGCLASS ) 
    end if 

and i think it is a memory management problem in function w32to_memory of w32memory.ew.

anyone able to debug that?

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu