Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions LICENSES/Unlicense.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Unlicense (Public Domain)
============================

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to &lt;<https://unlicense.org/>&gt;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions windows/windows_version_info/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
SPDX-FileCopyrightText: 2023 KOLANICH

SPDX-License-Identifier: Unlicense
-->

## `OSVERSIONINFO(EX)?[AW]` structures

* https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversionexa
* https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversionexw
* https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoa
* https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa
* https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfow
* https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexw

Generated with [`getOSVERSIONINFOEX.py`](./getOSVERSIONINFOEX.py)

Script: Own work.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
70 changes: 70 additions & 0 deletions windows/windows_version_info/getOSVERSIONINFOEX.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import platform
import typing
from ctypes import byref, c_char, c_char_p, c_void_p, windll
from pathlib import Path
from struct import pack

from wine_get_version import wine_get_version # https://github.com/KOLANICH-libs/wine_get_version.py

__author__ = "KOLANICH"
__license__ = "Unlicense"


GetVersionExA = windll.kernel32.GetVersionExA
GetVersionExA.argtypes = [c_void_p]

GetVersionExW = windll.kernel32.GetVersionExW
GetVersionExW.argtypes = [c_void_p]


def genPlatformString() -> str:
platformVersion = platform.system() + "_" + platform.version()
wineVersion = wine_get_version()
if wineVersion:
platformVersion += "_Wine_" + wineVersion
return platformVersion


def getVersionInfoForSize(func, size: int) -> bytes:
res = bytearray(size)
res[:4] = pack("<I", len(res))

func((c_char * len(res)).from_buffer(res))
return bytes(res)


funcs = [
(GetVersionExA, {"OSVERSIONINFOA": 148, "OSVERSIONINFOEXA": 156}),
(GetVersionExW, {"OSVERSIONINFOW": 276, "OSVERSIONINFOEXW": 284}),
]


def getStructs():
ress = {}
for func, sizes in funcs:
for name, size in sizes.items():
res = getVersionInfoForSize(func, size)
ress[name] = res
return ress


def main():
platformString = genPlatformString()
print(platformString)

cwd = Path(".")
outD = cwd / platformString
try:
outD.mkdir(parents=True)
except FileExistsError:
pass

structs = getStructs()
for name, data in structs.items():
outF = outD / (name + ".dat")
with outF.open("wb") as f:
f.write(data)


if __name__ == "__main__":
main()