Attention is currently required from: flichtenheld, plaisthos.

razvanc has posted comments on this change by flichtenheld. ( 
http://gerrit.openvpn.net/c/openvpn/+/1955?usp=email )

Change subject: Build against Windows 10 API and remove some backwards 
compatility code
......................................................................


Patch Set 1:

(1 comment)

File src/openvpn/win32.c:

http://gerrit.openvpn.net/c/openvpn/+/1955/comment/2e586562_54ee6de4?usp=email :
PS1, Line 1350:     if (is_wow64)
This is I believe a bug.

This patch doesn't introduce it, but after staring at the code for a bit, 
reading the Microsoft docs at 
https://learn.microsoft.com/en-us/windows/win32/api/wow64apiset/nf-wow64apiset-iswow64process2
 and doing more research it looks like the `BOOL` returned by 
`IsWow64Process2()` only tells us if the function suceeded or failed.

It can fail for reasons such as `ERROR_ACCESS_DENIED`, `ERROR_INVALID_HANDLE` 
or `ERROR_INVALID_PARAMETER`, and if it succeds it doesn't mean the process 
`is_wow64` really.


We may want something like this:

```
    USHORT process_machine = 0;
    USHORT native_machine = 0;
    if (!IsWow64Process2(GetCurrentProcess(), &process_machine, 
&native_machine))
    {
        return;
    }

    switch (native_machine)
    {
        case IMAGE_FILE_MACHINE_ARM64:
            *host_arch = ARCH_ARM64;
            break;

        case IMAGE_FILE_MACHINE_AMD64:
            *host_arch = ARCH_AMD64;
            break;

        case IMAGE_FILE_MACHINE_I386:
            *host_arch = ARCH_X86;
            break;

        default:
            *host_arch = ARCH_UNKNOWN;
            break;
    }

    if (*host_arch == *process_arch)
    {
        *host_arch = ARCH_NATIVE;
    }
```



--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1955?usp=email
To unsubscribe, or for help writing mail filters, visit 
http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I44d7171c7e4f8497bf8b902380df92a58bf8a79a
Gerrit-Change-Number: 1955
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: razvanc <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
Gerrit-Comment-Date: Mon, 28 Sep 2026 13:36:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to