Search the Community
Showing results for tags 'msix'.
-
I am looking to code IsRunningAsUwp() detection for AutoIt Apps published via the Windows Bridge to UWP borrowing from code here in C#: DesktopBridgeHelpers/Helpers.cs at master · qmatteoq/DesktopBridgeHelpers · GitHub More info also here: GetCurrentPackageFullName function (appmodel.h) - Win32 apps | Microsoft Docs The P/Invoke equivalent looks to be a pain in AutoIt and I am sure that DllStructCreate|GetData|GetPtr etc are required so if anyone one else finds this of interest and useful to them they are most welcome to contribute: I hacked a workaround as IsRunningAsUwp() (I think its only the "\VFS\" that matches!) whereas IsRunningAsUwpToDo() is to be fixed and coded up properly using DLLStruct functions as I mentioned and I figure that there will be a Guru around here with this stuff as I have also heard that the AutoIt Devs are planning a move to UWP and the below is going to be pretty fundamental (at least until then although similar will likely wind up in the libraries eventually anyways..). OutputDebugString() is here: #Include-once Func OutputDebugString($lpOutputString) DllCall("kernel32.dll", "NONE", "OutputDebugString", "STR", $lpOutputString) EndFunc The script to be fixed is here: #Include <OutputDebugString.au3> Const $APPMODEL_ERROR_NO_PACKAGE = 15700 Const $ERROR_INSUFFICIENT_BUFFER = 122 Func IsRunningAsUwp() If IsWindows7OrLower Then Return False EndIf Return StringinStr(@ScriptDir, "\WindowsApps\") > 0 Or StringInStr(@ScriptDir, "\VFS\") > 0 EndFunc Func IsRunningAsUwpToDo() If IsWindows7OrLower Then Return False EndIf Local $packageFullNameLength = 0; Local $packageFullName[$packageFullNameLength]; Local $result = DllCall("kernel32.dll", "LONG", "GetCurrentPackageFullName", "UINT32*", $packageFullNameLength, "PWSTR", $packageFullName) OutputDebugString("$result=" & String($result)) OutputDebugString("packageFullNameLength=" & String($packageFullNameLength)) OutputDebugString("packageFullName=" & String($packageFullName)) Local $packageFullName[$packageFullNameLength]; Local $result = DllCall("kernel32.dll", "LONG", "GetCurrentPackageFullName", "UINT32*", $packageFullNameLength, "PWSTR", $packageFullName) OutputDebugString("$result=" & String($result)) OutputDebugString("packageFullNameLength=" & String($packageFullNameLength)) OutputDebugString("packageFullName=" & String($packageFullName)) Return $result <> $APPMODEL_ERROR_NO_PACKAGE And $packageFullNameLength > 0 EndFunc Func IsWindows7OrLower() Local $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", 0x30) If IsObj($colItems) Then For $objItem In $colItems Local $version = $objItem.Version OutputDebugString("Win32_OperatingSystem.Version=" & $version) Return Number($version) <= 6.1 Next Else Msgbox(0, "", "No WMI Object for Version found in WMI Class Win32_OperatingSystem") Exit(-1) Endif Return False EndFunc Kindest Regards, Matthew
- 5 replies
-
- uwp
- windows store
-
(and 3 more)
Tagged with: