Windows 10 – Unpacking and Packing AppX

email me

These are some of my notes for working with AppX files.

You will need to install the SDK to use MakeAppx.exe, and make sure Developer Mode is enabled.

 

Developer Mode

reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock” /v “AllowDevelopmentWithoutDevLicense” /t REG_DWORD /d “1” /f /reg:64

reg.exe add “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock” /v AllowAllTrustedApps /t REG_DWORD /d 1 /f /reg:64

reg.exe add “HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Appx” /v AllowDevelopmentWithoutDevLicense /t REG_DWORD /d 1 /f /reg:64

reg.exe add “HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Appx” /v AllowAllTrustedApps /t REG_DWORD /d 1 /f /reg:64

 


Example SDK folder (location of tools)

C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64

 

Unbundle

MakeAppx.exe unbundle /p C:\example\AppleInc.iTunes_12090.167.37085.0_neutral_~_nzyj5cx40ttqa.AppxBundle /d C:\example\unbundle

 

Unpack

MakeAppx.exe unpack /p C:\example\unbundle\AppleInc.iTunes_12090.167.37085.0_x64.appx /d C:\example\unpack

 

Pack

MakeAppx pack /d C:\example\pack /p C:\example\sample1.appx

 


If you receive errors

Get-Appxlog | Out-GridView

 

Notes

Examples

MakeAppx pack /v /h SHA256 /d “C:\My Files” /p MyPackage.appx
MakeAppx pack /v /o /f MyMapping.txt /p MyPackage.appx
MakeAppx pack /m “MyApp\AppxManifest.xml” /f MyMapping.txt /p AppPackage.appx
MakeAppx pack /r /m “MyApp\AppxManifest.xml” /f MyMapping.txt /p ResourcePackage.appx
MakeAppx pack /v /h SHA256 /d “C:\My Files” /ep MyPackage.eappx /kf MyKeyFile.txt
MakeAppx pack /v /h SHA256 /d “C:\My Files” /ep MyPackage.eappx /kt
MakeAppx pack /v /h SHA256 /d “C:\My Files” /ep MyPackage.eappx /kt /np
MakeAppx pack /v /h SHA256 /d “C:\My Files” /p MyPackage.appx /ml 1073741824

 

Manually install unpacked AppX file

Add-AppxPackage -Path C:\example\AppxManifest.xml -Register


Signing your packages

makecert.exe -r -h 0 -n “CN=Publisher” -eku 1.3.6.1.5.5.7.3.3 -pe -sv C:\example\PackageCert.pvk C:\example\PackageCert.cer

pvk2pfx.exe -pvk C:\example\PackageCert.pvk -spc C:\example\PackageCert.cer -pfx C:\example\PackageCert.pfx

SignTool.exe sign /a /v /fd SHA256 /f C:\example\PackageCert.pfx C:\example\MyApp.appx

 

Manually add AppX file

Add-AppxPackage C:\Path\to\application.appx

 

All About AppX

What is an AppX?

The AppX is the file format used to distribute and install apps on the Universal Windows Platform. The AppX is an .ZIP-based container file.

What does an AppX package contain?

Each Windows Runtime app package contains the app’s payload files plus info needed to validate, deploy, manage, and update the app.

In an AppX package you will find:

  • App payload which is the Application files
  • XML configuration files which are:
    • App manifest which is the app manifest file (AppxManifest.xml)
    • App block map which is the app package’s block map file (AppxBlockMap.xml)
  • App signature

What is the installation type of a UWP app?

The UWP app is installed per-user. Users don’t have any knowledge of what was installed for any other user.

Where the UWP apps get installed?

In UWP apps we have app isolation mechanism, which means they only impact the account of the user who installed them. The app binaries are stored on the drive (%ProgramFiles%\WindowsApps). Only the Operating System can write in that location. The application cannot write in that location; the application is running in a sandbox.

What is a UWP package?

The UWP packages are Win32 apps converted to AppX. Are also called full trusted apps.

How to install an AppX package from other sources that you trust, outside of the Windows Store?

A requirement is to have “Sideload apps” option enabled on your target machine from “Settings” -> “Update and security” -> “For developers”.

There are two ways to sideload apps after Windows 10 Anniversary Update:

  • Full trust apps: double-click the AppX file from Windows Explorer and follow the graphical installer
  • Untrusted apps:
    • import the security certificate used to sign the AppX into the system store
    • run PowerShell cmdlet as admin
    • run following command pointing to the AppX file on the target system:
Add-AppxPackage -Path "C:\Path\Your.AppX"

Why do I receive the “External tool not found: MakePri.exe” error during the UwpAppX build?

For creating UwpAppX packages with Advanced Installer, the build machine must have the latest Windows SDK installed.

Why do I receive the “Error: SignerSign() failed. (-2147024885/0x8007000b)” error during the UwpAppX build?

This error may occur if the ID field from the Package Information view does not match with the publisher subject information of the certificate used to sign the package.

I have just converted a classic desktop application to an AppX package, why do I receive the “Failed due to unknown reasons” when I try to install it?

This error may occur if you have not included in your Advanced Installer Project all the images in Visual Assets and Package Information for all the required resolutions and tile sizes.

Matteo Pagani’s blog post offers a solution for the same issue if you used Microsoft’s Desktop App Converter for the conversion.

Can I configure the default app launched at the end of the deployment of an AppX bundle?

When you install a multi-app package from the Windows Store, there is no [ Launch ] button. Instead, you are directed to the app list to choose what app you want to start, meaning you cannot have a default app for an AppX bundle.

How do I access the AppX installation log?

First, you have to launch the Event Viewer by going to Start > Event Viewer (Local).

Once in the Event Viewer go to Applications and Services Logs > Microsoft > Windows > AppxPackagingOM > Microsoft-Windows-AppxPackaging/Operational.

Why do I get the “Invalid package identity name” error?

The package identity name must be composed of the publisher/company name and the app name (i.e., YourCompanyName.YourAppName).

Microsoft automatically detects your company name from your Windows Developer account.

Why do I get the “Invalid package family name” error?

The package family name is generated by the OS (not Advanced Installer) starting from the package identity name. The OS appends a hash at the end of the name, which is generated from the package and publisher identify information.

You cannot directly set this name. As long as you set the package identity name (as Microsoft requires) and the CN, the package family name will be set correctly.

Why do I get the “Invalid package publisher name” error?

When you publish an app in the store you no longer need to sign it with your certificate; the Microsoft Store will do it instead. Digital signing is only required when you test the app on your local machine or if you plan to distribute it outside the Microsoft Store.

When you publish the app in the store, you need to disable digital signing in Advanced Installer and set the publisher ID in the project to the value from your Microsoft Developer account, i.e., CN=82A13EFD-FE37-4EFC-8BA4-1C3E9EFE5F23

Why do I get the “This package’s manifest uses a display name that you have not reserved” error?

You must log in to your Windows Developer account (sign up if you don’t have one) and reserve your application name. For more details about registering a Windows Developer account see Microsoft’s documentation.

 

Notes

reg Query “HKLM\Hardware\Description\System\CentralProcessor\0” | find /i “x86” > NUL && set OS=32BIT || set OS=64BIT

if %OS%==32BIT goto 32Bit
if %OS%==64BIT goto 64Bit

 

 

DISM – OS Uninstall Options

email me

Windows gives a user the ability to uninstall and roll back to a previous version of Windows. You can use DISM to:

  • Find out how many days after an upgrade that an OS can be uninstalled
  • Initiate an uninstall
  • Remove the ability for a user to uninstall a Windows upgrade
  • Set the number of days that a user has to uninstall a Windows upgrade

 

/Get-OSUninstallWindow

Run this command against an online image to see how many days after an upgrade that an uninstall can be initiated.

DISM /Online /Get-OSUninstallWindow

 

/Initiate-OSUninstall

Run this command against an online image to revert a PC to a previous Windows installation.

DISM /Online /Initiate-OSUninstall

 

/Remove-OSUninstall

Run this command against an online image to remove the ability to roll back a PC to a previous installation of Windows.

DISM /Online /Remove-OSUninstall

 

/Set-OSUninstallWindow

Run this command against an online image to set the number of days after an upgrade that an uninstall can be initiated.

DISM /Online /Set-OSUninstallWindow /Value:30

 

Assembly – Addition and Subtraction

email me

< back

Tested using JDoodle.

See multiplication. Learning: 1  2  3  4  5  6  book

;SINGLE DIGIT ADDITION
;test here: https://www.jdoodle.com/compile-assembler-nasm-online

section	.text
   global _start        
	
_start:	                ;entry point
   mov	eax, '4'
   sub  eax, '0'
	
   mov 	ebx, '5'
   sub  ebx, '0'
   add 	eax, ebx
   add	eax, '0'
	
   mov 	[sum], eax
   mov	ecx, msg	
   mov	edx, len
   mov	ebx, 1	         ;file descriptor (stdout)
   mov	eax, 4	         ;system call number (sys_write)
   int	0x80	         ;call kernel
	
   mov	ecx,sum
   mov	edx, 1
   mov	ebx, 1	         ;ile descriptor (stdout)
   mov	eax, 4	         ;system call number (sys_write)
   int	0x80	         ;call kernel
	
   mov	eax, 1	         ;system call number (sys_exit)
   int	0x80	         ;call kernel
	
section .data
msg db "The sum is:", 0xA, 0xD 
len equ $ - msg   
segment .bss
sum resb 1

;;;;output: 9
;DOUBLE DIGIT ADDITION
;test here: https://www.jdoodle.com/compile-assembler-nasm-online

section .text
global _start

_start: ;entry point

mov esi, 1         ;right digit minus 1 placement. Example: 23 would be 2.
mov ecx, 2         ;total digits. Example 48 would be 2.
clc
add_loop:
mov al, [num1 + esi]
adc al, [num2 + esi]
aaa
pushf
or al, 30h
popf

mov [sum + esi], al
dec esi
loop add_loop

mov edx, len       ;message length
mov ecx, msg       ;message to write
mov ebx, 1         ;file descriptor (stdout)
mov eax, 4         ;system call number (sys_write)
int 0x80           ;call kernel

mov edx, 5         ;message length
mov ecx, sum       ;message to write
mov ebx, 1         ;file descriptor (stdout)
mov eax, 4         ;system call number (sys_write)
int 0x80           ;call kernel

mov eax, 1         ;system call number (sys_exit)
int 0x80           ;call kernel

section .data
msg db 'The Sum is:', 0xa
len equ $ - msg
num1 db '12'
num2 db '23'
sum db ' '

;;;;output: 35
;SINGLE DIGIT ADDITION - ACCEPT USER INPUT
;test here: https://www.jdoodle.com/compile-assembler-nasm-online

SYS_EXIT  equ 1
SYS_READ  equ 3
SYS_WRITE equ 4
STDIN     equ 0
STDOUT    equ 1

segment .data 

   msg1 db "Enter a digit ", 0xA, 0xD 
   len1 equ $- msg1 

   msg2 db "Please enter a second digit", 0xA, 0xD 
   len2 equ $- msg2 

   msg3 db "The sum is: "
   len3 equ $- msg3

segment .bss

   num1 resb 2 
   num2 resb 2 
   res resb 1    

section	.text
   global _start    
	
_start:             ;entry point
   mov eax, SYS_WRITE         
   mov ebx, STDOUT         
   mov ecx, msg1         
   mov edx, len1 
   int 0x80                

   mov eax, SYS_READ 
   mov ebx, STDIN  
   mov ecx, num1 
   mov edx, 2
   int 0x80            

   mov eax, SYS_WRITE        
   mov ebx, STDOUT         
   mov ecx, msg2          
   mov edx, len2         
   int 0x80

   mov eax, SYS_READ  
   mov ebx, STDIN  
   mov ecx, num2 
   mov edx, 2
   int 0x80        

   mov eax, SYS_WRITE         
   mov ebx, STDOUT         
   mov ecx, msg3          
   mov edx, len3         
   int 0x80

   ; moving the first number to eax register and second number to ebx
   ; and subtracting ascii '0' to convert it into a decimal number
	
   mov eax, [num1]
   sub eax, '0'
	
   mov ebx, [num2]
   sub ebx, '0'

   ; add eax and ebx
   add eax, ebx
   ; add '0' to to convert the sum from decimal to ASCII
   add eax, '0'

   ; storing the sum in memory location res
   mov [res], eax

   ; print the sum 
   mov eax, SYS_WRITE        
   mov ebx, STDOUT
   mov ecx, res         
   mov edx, 1        
   int 0x80

exit:    
   
   mov eax, SYS_EXIT   
   xor ebx, ebx 
   int 0x80
;SUBTRACTION
;test here: https://www.jdoodle.com/compile-assembler-nasm-online

section .text
global _start 

_start:           ;entry point
sub ah, ah
mov al, '5'
sub al, '2'
aas
or al, 30h
mov [res], ax

mov edx, len       ;message length
mov ecx, msg       ;message to write
mov ebx, 1         ;file descriptor (stdout)
mov eax, 4         ;system call number (sys_write)
int 0x80           ;call kernel

mov edx, 1         ;message length
mov ecx, res       ;message to write
mov ebx, 1         ;file descriptor (stdout)
mov eax, 4         ;system call number (sys_write)
int 0x80           ;call kernel

mov eax, 1         ;system call number (sys_exit)
int 0x80           ;call kernel

section .data
msg db 'The Result is:', 0xa
len equ $ - msg
section .bss
res resb 1

;;;output: 3


 

Screenshot

 

Notes

If you need an app to test your code, try emu8086

Addition, ran in emu8086

.MODEL SMALL
.STACK 200H
.DATA
NUM1 DB 12 ; number 1 to be added
NUM2 DB 10 ; number 2 to be added
VAL DW ?
MSG3 DB "Result: "
DECIMAL DB "00000$"

.CODE
BEGIN PROC
MOV AX, @DATA
MOV DS, AX

XOR AX, AX
MOV AL, NUM1
ADD AL, NUM2
ADC AH, 0
MOV VAL, AX

MOV AX, VAL
CALL AX_to_DEC

LEA DX, MSG3
MOV AH, 9
INT 21H

MOV AX, 4C00H
INT 21H
BEGIN ENDP

AX_to_DEC PROC
mov bx, 10 ; divisor
xor cx, cx ; CX=0 (number of digits)

First_Loop:
xor dx, dx ; Attention: DIV applies also DX!
div bx ; DX:AX / BX = AX remainder: DX
push dx ; LIFO
inc cx ; increment number of digits
test ax, ax ; AX = 0?
jnz First_Loop ; no: once more

mov di, OFFSET DECIMAL ; target string DECIMAL
Second_Loop:
pop ax ; get back pushed digit
or ax, 00110000b ; to ASCII
mov byte ptr [di], al ; save AL
inc di ; DI points to next character in string DECIMAL
loop Second_Loop ; until there are no digits left

mov byte ptr [di], '


Information

DB – Define Byte (Size – 1 Byte)

DW – Define Word (Size – 2 Byte)

DD – Define Double word (Size - 4 Bytes)

DQ – Define Quad word (Size – 8 Bytes)

DT – Define Ten Bytes (Size – 10 Bytes)

https://pinetools.com/syntax-highlighter
 ; End-of-string delimiter for INT 21 / FN 09h
ret
AX_to_DEC ENDP

END BEGIN


Information

DB – Define Byte (Size – 1 Byte)

DW – Define Word (Size – 2 Byte)

DD – Define Double word (Size – 4 Bytes)

DQ – Define Quad word (Size – 8 Bytes)

DT – Define Ten Bytes (Size – 10 Bytes)

https://pinetools.com/syntax-highlighter

Citrix – Moves from Receiver to Workspace

email me

Citrix Workspace app for Windows

Citrix Workspace app for Windows is an easy-to-install software that provides access to your applications and desktops using XenApp and XenDesktop from a remote client device. Citrix Workspace app provides access from your desktop, Start menu, Citrix Workspace user interface, or web browsers.

You can use Citrix Workspace app on domain and non-domain joined PCs, tablets, and thin clients. Using Citrix StoreFront in conjunction with Citrix Workspace app allows your organization to provide you with self-service access to your applications and desktops – all with a common user interface, regardless of the endpoint device hardware, operating system (32-bit and 64-bit editions), or form factor.


Silent Command

citrix.exe” /rcu /silent STORE0=”Store;https://mycitrix.umc.edu/Citrix/ummcWeb/discovery;Store”


Downloads

CitrixWorkspace_ADMX_Files.zip
CitrixWorkspace_Installation_Scripts.zip
CitrixCtxReceiverCmdLineHelper.zip


more…

About Citrix Workspace app

When powered by Citrix Workspace services, the new Citrix Workspace app gives users instant access to all their SaaS and web apps, their files and mobile apps, and their virtual apps and desktops from an easy-to-use, all-in-one interface. Citrix Workspace app is a single point of entry to all workspace services for users. Users get seamless and secure access to all the apps they need to stay productive, including features such as embedded browsing and single sign-on.

Citrix Workspace app aggregates and incorporates the full capabilities of Citrix Receiver as well as other Citrix client technologies – including HDX, the NetScaler plug-ins, and Citrix Endpoint Management Secure Hub. Citrix Workspace app also has full integration of Citrix Content Collaboration (formerly ShareFile) in the new Files tab. With this integration, all your data is accessible within Citrix Workspace app. The ability to upload and download files and even open files within Citrix Workspace app are now integrated into one application. Citrix Workspace app is also enhanced to deliver additional capabilities regarding data loss prevention, secure access to SaaS apps, secure internet browsing capabilities, advanced search, and more.

Workspace configuration

Citrix Workspace app for Windows supports configuring Workspaces for subscribers, who might be using one or more services available from Citrix Cloud.

Citrix Workspace app will intelligently display only the specific workspace resources to which users are entitled. All your digital workspace resources available in Citrix Workspace app are powered by the Citrix Cloud Workspace experience service.

A workspace is part of a digital workspace solution that enables IT to securely deliver access to apps from any device. This screenshot is an example of what the workspace experience looks like to your subscribers. This interface is evolving and may look different to what your subscribers are working with today. For example, it might say “StoreFront” at the top of the page instead of “Workspace”.

 

Scripts for Deploying Citrix Workspace app for Windows

This ZIP file contains sample scripts to deploy and configure Citrix Workspace app. It is an optional download, provided on an as-is basis by Citrix to serve as an example. Before use, IT administrators must customize the scripts to suit their environment. The uninstall and install scripts may be used as noted in the upgrade guide for Citrix Workspace app for Windows (CTX135933). Version: 18.9.0.19526 (1809)

 

Citrix ADMX/ ADML Templates for Group Policy Editor

This ZIP file contains ADMX and ADML files to deploy and configure Citrix Workspace app using group policy object editor. It is an optional download, to be used by IT administrators, and not meant for use by end-users. The administrative templates (ADMX and ADML files) may be used as noted in the upgrade guide for Citrix Workspace app for Windows (CTX135933). Version: 18.9.0.19526 (1809)

 

Citrix Receiver CmdLine Tool 1.0

Select the options in the GUI, click on “Generate CmdLine” and the tool will display the full commandline in the tool, as well as copying it to the clipboard.

When clicking on “Save as batch file,” the tool will generate a batch file ready to use (including the registry entry if needed)

 

Notes

Configure and install using command-line parameters

Customize Citrix Receiver for Windows installer by specifying command line options. The installer package self-extracts to the user’s temp directory before launching the setup program. The space requirement includes program files, user data, and temp directories after launching several applications.

For more information about system requirements, see System requirements.

To install Citrix Receiver for Windows from a command prompt, use the syntax:

CitrixReceiver.exe [Options]

Receiver Updates

Option /AutoUpdateCheck = auto/manual/disabled
Description Indicates that Citrix Receiver for Windows detects when an update is available. Auto – You are notified when an update is available (default).; Manual –You are not notified when updates are available. Check for updates manually.; Disabled – Disable auto-update
Sample usage CitrixReceiver.exe /AutoUpdateCheck = auto ; CitrixReceiver.exe /AutoUpdateCheck = manual ; CitrixReceiver.exe /AutoUpdateCheck = disabled
Option /AutoUpdateStream= LTSR/Current
Description Indicates the release of Citrix Receiver for Windows. LTSR – indicates that the release is a Long Term Service Release ; Current – indicates that the release is the latest version of Citrix Receiver for Windows
Sample usage CitrixReceiver.exe /AutoUpdateStream= LTSR ; CitrixReceiver.exe /AutoUpdateStream= Current
Option /DeferUpdateCount
Description Indicates the release of Citrix Receiver for Windows. -1 – indicates that you can defer the notifications any number of times (default value=-1) ; 0 – indicates that the Remind me later option is not displayed. Any other number – indicates that the Remind me later option is displayed in that count. For example, if you set the value to 10, the Remind me later option is displayed 10 times.
Sample usage CitrixReceiver.exe /DeferUpdateCount=-1 ; CitrixReceiver.exe /DeferUpdateCount=-0 ; CitrixReceiver.exe /DeferUpdateCount=any other number
Option /AURolloutPriority
Description Indicates the period when you can stage the rollout. Fast – Update rollout happens at the beginning of the delivery period. Medium – Update rollout happens at the mid-delivery period. Slow – Update rollout happens at the end of the delivery period.
Sample usage CitrixReceiver.exe /AURolloutPriority=Fast ; CitrixReceiver.exe /AURolloutPriority=Medium ; CitrixReceiver.exe /AURolloutPriority=Slow

Enable bidirectional content redirection

Note

By default, Citrix Receiver for Windows does not install the bidirectional content redirection components if they are already installed on the server. If you are using XenDesktop as a client machine, you must install Citrix Receiver for Windows by using the /FORCE_LAA switch to install the bidirectional content redirection components. The feature, however, must be configured both on the server and the client.

Option ALLOW_BIDIRCONTENTREDIRECTION=1
Description Indicates that the bidirectional content redirection between client to host and host to the client is Enabled.
Sample usage CitrixReceiver.exe /ALLOW_BIDIRCONTENTREDIRECTION=1

Hide Settings Option

Option /DisableSetting
Description Suppresses Settings Option to be displayed in the Advanced Preferences dialog.
Sample usage CitrixReceiver.exe /DisableSetting=3
If you want both Application Display and Reconnect Options to be displayed in the Settings Option.. Enter CitrixReceiver.exe /DisableSetting=0
If you want Settings Option to be hidden in the Advanced Preferences dialog Enter CitrixReceiver.exe /DisableSetting=3
If you want Settings Option to display only Application Display Enter CitrixReceiver.exe /DisableSetting=2
If you want Settings Option to display only Reconnect Options Enter CitrixReceiver.exe /DisableSetting=1

Enable Local App Access

Option FORCE_LAA=1
Description By default, Citrix Receiver for Windows does not install the client side Local App Access components if the components are already installed on the server. To force the client side Local App Access components on the Citrix Receiver, use FORCE_LAA command line switch. Administrator-level privileges are required to perform these steps. For more information on Local App Access, see Local App Access in XenApp and XenDesktop documentation.
Sample usage CitrixReceiver.exe /FORCE_LAA =1

Display usage information

Option /? or /help
Description Indicates usage information
Sample usage CitrixReceiver.exe /? ; CitrixReceiver.exe /help

Suppress reboot during UI installation

Option /noreboot
Description Suppresses reboot during UI installations. This option is not necessary for silent installs. If you suppress reboot prompts, the USB devices that are in suspended state when Citrix Receiver for Windows installs is not recognized by Citrix Receiver for Windows until after the user device is restarted.
Sample usage CitrixReceiver.exe /noreboot

Silent installation

Option /silent
Description SDisables the error and progress dialogs to run a completely silent installation.
Sample usage CitrixReceiver.exe /silent

Enable single sign on authentication

Option /includeSSON
Description Indicates that the Citrix Receiver for Windows will be installed with the single sign-on component. The related option, ENABLE_SSON, is enabled when /includeSSON is on the command line. If you use ADDLOCAL= to specify features and you want to install the single sign on, you must also specify the value SSON. To enable pass-through authentication for a user device, you must install Citrix Receiver for Windows with local administrator rights from a command line that has the option /includeSSON. For more information, see How to Manually Install and Configure Citrix Receiver for Pass-Through Authentication. Note: Smart card, Kerberos and Local user name and password policies are inter-dependent. The order of configuration is important. We recommend to first disable unwanted policies, and then enable the policies you require. Carefully validate the result.
Sample usage CitrixReceiver.exe /includeSSON

Enable single sign on when /includeSSON is specified

Option ENABLE_SSON={Yes, No}
Description Enable Single sign-on when /includeSSON is specified. The default value is Yes. This property is required for smart card Single sign-on. Users must log off and log in to their devices after installing with Single sign-on authentication enabled. Requires administrator rights.
Sample usage CitrixReceiver.exe ENABLE_SSON=Yes

Always-on tracing

Option /EnableTracing={true, false}
Description By default, this feature is set to true. Use this property to enable or disable the always-on tracing feature. Always-on tracing helps to collect critical logs around the connection time. These logs can prove useful when troubleshooting intermittent connectivity issues. The Always On tracing policy overrides this setting.
Sample usage CitrixReceiver.exe /EnableTracing=true

Using the Citrix Customer Experience Improvement Program (CEIP)

Option EnableCEIP={true , false }
Description When you enable participation in the Citrix Customer Experience Improvement Program (CEIP), anonymous statistics and usage information are sent to Citrix to help Citrix improve the quality and performance of its products.
Sample usage CitrixReceiver.exe EnableCEIP=true

Specify the installation directory

Option INSTALLDIR=Installation Directory
Description Specifies the installation path where most of the Citrix Receiver software is installed. The default value is C:\Program Files\Citrix\Receiver. The following Receiver components are installed in the C:\Program Files\Citrix path: Authentication Manager ; Citrix Receiver ; Self-Service plug-in. If you use this option and specify an Installation directory, you must install RIInstaller.msi file in the \Receiver directory and the other .msi files in the installation directory.
Sample usage CitrixReceiver.exe INSTALLDIR=c:\Citrix\Test

Identify a user device

Option CLIENT_NAME=ClientName
Description Specifies the client name, where ClientName is the name used to identify the user device to the server. The default value is %COMPUTERNAME%
Sample usage CitrixReceiver.exe CLIENT_NAME=%COMPUTERNAME%.

Dynamic client name

Option ENABLE_CLIENT_NAME=Yes, No
Description The dynamic client name feature allows the client name to be the same as the computer name. When users change their computer name, the client name changes to match. Defaults to Yes. To disable dynamic client name support, set this property to No and specify a value for the CLIENT_NAME property.
Sample usage CitrixReceiver.exe ENABLE_DYNAMIC_CLIENT_NAME =Yes

Install specified components

Option ADDLOCAL=<feature… ,>
Description Installs set of local features specified in ADDLOCAL.
Sample usage CitrixReceiver.exe ADDLOCAL=ReceiverInside,ICA_Client,AM,SELFSERVICE,DesktopViewer,Flash,Vd3d,usb,WebHelper

Configure Citrix Receiver for Windows to manually add Stores

Option ENABLE_CLIENT_NAME=Yes, No
Description The dynamic client name feature allows the client name to be the same as the computer name. When users change their computer name, the client name changes to match. Defaults to Yes. To disable dynamic client name support, set this property to No and specify a value for the CLIENT_NAME property.
Sample usage CitrixReceiver.exe ENABLE_DYNAMIC_CLIENT_NAME =Yes

Save credentials for stores locally using PNAgent protocol

Option ALLOWSAVEPWD={N, S, A}
Description The default is the value specified by the PNAgent server at runtime. Specifies whether users can save the credentials for stores locally on their computers and apply only to stores using the PNAgent protocol. Defaults to S. Options include: N – Never allow users to save their passwords. S – Allow users to save passwords for both secure stores (HTTPS) and non-secure stores (HTTPS) and non-secure stores (HTTP). You can also control this feature by updating the registry key HKLM\Software[Wow6432Node]\Citrix\Dazzle\AllowSavePwd. Note: The following registry key must be added manually if AllowSavePwd does not work: 1 Key for 32 bit OS client: HKLM\Software\Citrix\AuthManager 2 Key for 64 bit OS client: HKLM\Software\wow6432node\Citrix\AuthManager 3 Type: REG_SZ 4 Value: never – never allow users to save their passwords. secureonly – allow users to save passwords for secure stores only (configured with HTTPS). always – allow users to save passwords for both secure stores (HTTPS) and non-secure stores (HTTP).
Sample usage CitrixReceiver.exe ALLOWADDSTORE=N

Select certificate

Option AM_CERTIFICATESELECTIONMODE={Prompt, SmartCardDefault, LatestExpriry }
Description Use this option to select a certificate. The default value is Prompt, which prompts the user to choose a certificate from a list. Change this property to choose the default certificate (per the smart card provider) or the certificate with the latest expiry date. If there are no valid logon certificates, the user is notified, and given the option to use an alternate logon method if available.You can also control this feature by updating the registry key HKCU or HKLM\Software[Wow6432Node]Citrix\AuthManager:CertificateSelectionMode={ Prompt SmartCardDefault LatestExpiry }. Values defined in HKCU take precedence over values in HKLM to best assist the user in selecting a certificate.
Sample usage CitrixReceiver.exe AM_CERTIFICATESELECTIONMODE=Prompt

Use CSP components to manage Smart Card PIN entry

Option AM_SMARTCARDPINENTRY=CSP
Description Use CSP components to manage Smart Card PIN entry. By default, the PIN prompts presented to users are provided by Citrix Receiver rather than the smart card Cryptographic Service Provider (CSP). Receiver prompts users to type a PIN when required and then passes the PIN to the smart card CSP. Specify this property to use the CSP components to manage the PIN entry, including the prompt for a PIN.
Sample usage CitrixReceiver.exe AM_SMARTCARDPINENTRY=CSP

Using Kerberos

Option ENABLE_KERBEROS={Yes , No}
Description The default value is No. Specifies whether the HDX engine should use Kerberos authentication and applies only when single sign-on (pass-through) authentication is enabled. For more information, see Configure domain pass-through authentication with Kerberos.
Sample usage CitrixReceiver.exe ENABLE_KERBEROS=No

Displaying legacy FTA icons

Option LEGACYFTAICONS={False, True}
Description Use this option to display Legacy FTA icons. The default value is False. Specifies whether or not application icons are displayed for documents that have file type associations with subscribed applications. When the argument is set to false, Windows generates icons for documents that do not have a specific icon assigned to them. The icons generated by Windows consist of a generic document icon overlaid with a smaller version of the application icon. Citrix recommends enabling this option if you plan to deliver Microsoft Office applications to users running Windows 7.
Sample usage CitrixReceiver.exe LEGACYFTAICONS=False

Enabling pre-launch

Option ENABLEPRELAUNCH={False, True}
Description The default value is False. For information about session pre-launch, see Reduce application launch time.
Sample usage CitrixReceiver.exe ENABLEPRELAUNCH=False

Specifying the directory for Start Menu shortcuts

Option STARTMENUDIR={Directory Name}
Description By default, applications appear under Start > All Programs. You can specify the relative path of the shortcuts in the programs folder. For example, to place shortcuts under Start > All Programs > Receiver, specify STARTMENUDIR=\Receiver. You can change or move the folder at any time.You can also control this feature using a registry key: Create the entry REG_SZ for StartMenuDir and give it the value “\RelativePath” Location: HKEY_LOCAL_MACHINE\Software[Wow6432Node]Citrix\Dazzle , HKEY_CURRENT_USER\Software\Citrix\Dazzle. For applications published through XenApp with a Client applications folder (also referred to as a Program Neighborhood folder) specified, you can specify that the client applications folder is to be appended to the shortcuts path as follows: Create the entry REG_SZ for UseCategoryAsStartMenuPath and give it the value “true.” Use the same registry locations as noted above.Note: Windows 8/8.1 does not allow you to create nested folders within the Start menu. Applications are displayed individually or inside the root folder and not within defined Category sub folders. Examples: 1 If client application folder is \office, UseCategoryAsStartMenuPath is true, and no StartMenuDiris specified, shortcuts are placed under Start > All Programs > Office. 2 If Client applications folder is \Office, UseCategoryAsStartMenuPath is true, and StartMenuDir is \Receiver, shortcuts are placed under Start > All Programs > Receiver > Office. Changes made to these settings have no impact on shortcuts that are already created. To move shortcuts, you must uninstall and reinstall the applications
Sample usage CitrixReceiver.exe STARTMENUDIR=\Office

Specifying the Store Name

Option STOREx=”storename;http[s]://servername.domain/IISLocation/discovery;[On, Off] ; [storedescription] “[STOREy=”–”]
Description Use this option to specify the Store name. Specifies up to 10 stores to use with Citrix Receiver. Values: x and y – Integers 0 through 9.; storename – Defaults to store. This must match the name configured on the StoreFront Server.; servername.domain – The fully qualified domain name of the server hosting the store. ; IISLocation – the path to the store within IIS. The store URL must match the URL in StoreFront provisioning files. The store URLs are of the form “/Citrix/store/discovery.” To obtain the URL, export a provisioning file from StoreFront, open it in notepad and copy the URL from the Address element.; On, Off – The optional Off configuration setting enables you to deliver disabled stores, giving users the choice of whether or not they access them. When the store status is not specified, the default setting is On. storedescription – An optional description of the store, such as HR App Store.Note: In this release, it is important to include “/discovery” in the store URL for successful pass-through authentication.
Sample usage CitrixReceiver.exe STORE0=”Store;https://test.xx.com/Citrix/Store/Discovery

Enabling URL Redirection on user devices

Option ALLOW_CLIENTHOSTEDAPPSURL=1
Description Enables the URL redirection feature on user devices. Requires administrator rights. Requires that Citrix Receiver is installed for All Users. For information about URL redirection, see Local App Access and its subtopics in the XenDesktop 7 documentation.
Sample usage CitrixReceiver.exe ALLOW_CLIENTHOSTEDAPPSURL=1

Enabling self-service mode

Option SELFSERVICEMODE={False , True}
Description The default value is True. When the administrator sets the SelfServiceMode flag to false, the user no longer has access to the self-service Citrix Receiver user interface. Instead, they can access subscribed apps from the Start menu and via desktop shortcuts – known as “shortcut-only mode”.
Sample usage CitrixReceiver.exe SELFSERVICEMODE=False

Specifying the directory for Desktop Shortcuts

Option DESKTOPDIR=Directory Name
Description Brings all shortcuts into a single folder. Category Path is supported for desktop shortcuts. Note: When using the DESKTOPDIR option, set the PutShortcutsOnDesktop key to True.
Sample usage CitrixReceiver.exe DESKTOPDIR=\Office

Upgrading from an unsupported Citrix Receiver version

Note

When you upgrade Citrix Receiver Version 13.x Enterprise or 12.x to Citrix Receiver for Windows Version 4.4 and later using the graphical user interface, the installer runs the Receiver cleanup utility by default.

However, the utility does not run by default when you upgrade from the command line. To upgrade from the command line, run the following command:

CitrixReceiver.exe /rcu /silent

When you upgrade Citrix Receiver for Windows from 13.x (non-Enterprise) or 4.1 to Version 4.2 or later, the /rcu switch is unnecessary and ignored.

Option /rcu
Description Allows you to upgrade from an unsupported version to the latest version of Citrix Receiver.
Sample usage CitrixReceiver.exe /rcu

Troubleshooting the installation

If there is a problem with the installation, search in the user’s %TEMP%/CTXReceiverInstallLogs directory for the logs with the prefix CtxInstall- or TrolleyExpress- . For example:

CtxInstall-ICAWebWrapper-20141114-134516.log

TrolleyExpress-20090807-123456.log

Examples of a command line installation

To specify the NetScaler Gateway store URL:

CitrixReceiver.exe STORE0=”<StoreFriendlyName>;testserver <StoreName>;<On/Off>;<StoreDescription>”]

Note: The NetScaler Gateway store URL must be the first entry in the list of configured store URLs.

To install all components silently and specify two application stores:

alt_text

To specify single sign-on (pass-through authentication) and add a store that points to a XenApp Services URL:

alt_text

C# – Arrays

email me

Compiled in Visual Studio 2017.

using System;
using System.Linq;

class Program
{
static ref int FirstElement(int[] array)
{
return ref array[0];
}

static void Main()
{
int[] array1 = { 1, 4, 2, 7, 6, 4, 4, 5, 3, 7 };
int[] array2 = new int[10];
int maxValue = array1.Max();
int indexElement = Array.IndexOf(array1, maxValue);

// display elements in array1
Console.Write("Original Array1: ");
for (int i = 0; i < array1.Length; i++)
{
Console.Write(array1[i]);
Console.Write(' ');
}

// max value
Console.Write("\n\nMax value in array: {0}", maxValue);
// index of max value
Console.Write("\n\nIndex of max value in array: {0}", indexElement);
Console.Write("\n\n");

// sort ascending
Console.Write("Array1 sorted ascending: ");
Array.Sort(array1);
for (int i = 0; i < array1.Length; i++)
{
Console.Write(array1[i]);
Console.Write(' ');
}
Console.Write("\n\n");

// sort descending
Console.Write("Array1 sorted descending: ");
Array.Reverse(array1);
for (int i = 0; i < array1.Length; i++)
{
Console.Write(array1[i]);
Console.Write(' ');
}
Console.Write("\n\n");

// make a change to array1, index 0
FirstElement(array1) = 9;

// display elements with a change in array1
Console.Write("Array1 with changed element: ");
for (int i = 0; i < array1.Length; i++)
{
Console.Write(array1[i]);
Console.Write(' ');
}
Console.Write("\n\n");

// copy all elements from array1 to array2
int[] array1OriginalData1 = { 1, 4, 2, 7, 6, 4, 4, 5, 3, 7 };
Array.Copy(array1OriginalData1, 0, array2, 0, 10);

int[] array1OriginalData2 = { 1, 4, 2, 7, 6, 4, 4, 5, 3, 7 };

// display elements in array2
Console.Write("Array2 copied from Array1: ");
for (int i = 0; i < array2.Length; i++)
{
Console.Write(array2[i]);
Console.Write(' ');
}
Console.Write("\n\n");

// Array.Copy
// p1 = source array
// p2 = start index in source array
// p3 = destination array
// p4 = start index in destination array
// p5 = elements to copy

// array1 with index
Console.Write("Array1 sorted with Index:\n");
for (int i = 0; i < array1OriginalData1.Length; i++)
{
int indexVal = Array.IndexOf(array1OriginalData1, array1OriginalData1[i]);
Console.Write(array1OriginalData1[i] + "(" + indexVal.ToString() + ")");
Console.Write(' ');
}
Console.Write("\n\n");

// sort array1 into array2 by max value

Console.Write("Array2 sorted by max value from Array1: ");
// sort descending
Array.Reverse(array1OriginalData1);

// move by index value to array2
for (int i = 0; i < array1.Length; i++)
{
Array.Copy(array1OriginalData1, i, array2, i, 1);
Console.Write(array2[i]);
Console.Write(' ');
}
Console.Write("\n\n");

Console.Write("\n\nCleared array 1\n");
Array.Clear(array1, 0, array1.Length);
for (int i = 0; i < array1.Length; i++)
{
Console.Write(array1[i]);
Console.Write(' ');
}
Console.Write("\n");

Console.Write("\n\nCleared array 2\n");
Array.Clear(array2, 0, array2.Length);
for (int i = 0; i < array2.Length; i++)
{
Console.Write(array2[i]);
Console.Write(' ');
}
Console.Write("\n");

Console.ReadKey();
}
}

C# – Check Email Address Formatting

email me

Uses EmailAddressAttribute (uses RegEx) — see Notes.

Compiled in Visual Studio 2017.

using System;
using System.ComponentModel.DataAnnotations;

class CheckEmails
{
static void Main(string[] args)
{
var objEmail = new EmailAddressAttribute();
bool testEmailAddress;
testEmailAddress = objEmail.IsValid("eddie@aol.com");
Console.Write("eddie@aol.com: " + testEmailAddress);

testEmailAddress = objEmail.IsValid("eddie@aol.org");
Console.Write("\n\neddie@aol.org: " + testEmailAddress);

testEmailAddress = objEmail.IsValid("eddie+isme@aol.net");
Console.Write("\n\neddie+isme@aol.net: " + testEmailAddress);

testEmailAddress = objEmail.IsValid("edward@aol.yooo");
Console.Write("\n\nedward@aol.yooo: " + testEmailAddress);

testEmailAddress = objEmail.IsValid("test");
Console.Write("\n\ntest: " + testEmailAddress);

testEmailAddress = objEmail.IsValid("test@");
Console.Write("\n\ntest@: " + testEmailAddress);

testEmailAddress = objEmail.IsValid("test@abcd");
Console.Write("\n\ntest@abcd: " + testEmailAddress);

testEmailAddress = objEmail.IsValid("test@abcd.");
Console.Write("\n\ntest@abcd.: " + testEmailAddress);

// using an if statement
if (new EmailAddressAttribute().IsValid("\n\neddie@aol.com"))
testEmailAddress = true;
Console.Write("\n\neddie@aol.com: " + testEmailAddress);

// wait
Console.ReadKey();
}
}

 

Notes

EmailAddressAttribute

namespace System.ComponentModel.DataAnnotations {
using System;
using System.ComponentModel.DataAnnotations.Resources;
using System.Text.RegularExpressions;

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class EmailAddressAttribute : DataTypeAttribute {

// This attribute provides server-side email validation equivalent to jquery validate,
// and therefore shares the same regular expression.  See unit tests for examples.
private static Regex _regex = CreateRegEx();

public EmailAddressAttribute()
: base(DataType.EmailAddress) {

// DevDiv 468241: set DefaultErrorMessage not ErrorMessage, allowing user to set
// ErrorMessageResourceType and ErrorMessageResourceName to use localized messages.
DefaultErrorMessage = DataAnnotationsResources.EmailAddressAttribute_Invalid;
}

public override bool IsValid(object value) {
if (value == null) {
return true;
}

string valueAsString = value as string;

// Use RegEx implementation if it has been created, otherwise use a non RegEx version.
if (_regex != null) {
return valueAsString != null &amp;&amp; _regex.Match(valueAsString).Length &gt; 0;
}
else {
int atCount = 0;

foreach (char c in valueAsString) {
if (c == '@') {
atCount++;
}
}

return (valueAsString != null
&amp;&amp; atCount == 1
&amp;&amp; valueAsString[0] != '@'
&amp;&amp; valueAsString[valueAsString.Length - 1] != '@');
}
}

private static Regex CreateRegEx() {
// We only need to create the RegEx if this switch is enabled.
if (AppSettings.DisableRegEx) {
return null;
}

const string pattern = @"^((([a-z]|\d|[!#\$%&amp;'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&amp;'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$";
const RegexOptions options = RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture;

// Set explicit regex match timeout, sufficient enough for email parsing
// Unless the global REGEX_DEFAULT_MATCH_TIMEOUT is already set
TimeSpan matchTimeout = TimeSpan.FromSeconds(2);

try {
if (AppDomain.CurrentDomain.GetData("REGEX_DEFAULT_MATCH_TIMEOUT") == null) {
return new Regex(pattern, options, matchTimeout);
}
}
catch {
// Fallback on error
}

// Legacy fallback (without explicit match timeout)
return new Regex(pattern, options);
}
}
}

PowerShell – Return LastWriteTime Registry Key

email me

$Namespace = "ReadRegDate"

Add-Type @"

using System;

using System.Text;

using System.Runtime.InteropServices;

$($Namespace | ForEach-Object {

"namespace $_ {"

})

public class advapi32 {

[DllImport("advapi32.dll", CharSet = CharSet.Auto)]

public static extern Int32 RegQueryInfoKey(

Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey,

StringBuilder lpClass,

[In, Out] ref UInt32 lpcbClass,

UInt32 lpReserved,

out UInt32 lpcSubKeys,

out UInt32 lpcbMaxSubKeyLen,

out UInt32 lpcbMaxClassLen,

out UInt32 lpcValues,

out UInt32 lpcbMaxValueNameLen,

out UInt32 lpcbMaxValueLen,

out UInt32 lpcbSecurityDescriptor,

out System.Runtime.InteropServices.ComTypes.FILETIME lpftLastWriteTime

);

}

$($Namespace | ForEach-Object {

"}"

})

"@

# Store the type in a variable:

$RegTools = ("{0}.advapi32" -f ($Namespace -join ".")) -as [type]

# Get a RegistryKey object (we need the handle)

$RegKey = Get-Item HKLM:\SOFTWARE

# Create any properties that we want returned:

$LastWrite = New-Object System.Runtime.InteropServices.ComTypes.FILETIME

# Call function:

$RegTools::RegQueryInfoKey($RegKey.Handle, $null, [ref] $null, $null, [ref] $null, [ref] $null, [ref] $null, [ref] $null, [ref] $null, [ref] $null, [ref] $null, [ref] $LastWrite)

# Convert to DateTime object:

$UnsignedLow = [System.BitConverter]::ToUInt32([System.BitConverter]::GetBytes($LastWrite.dwLowDateTime), 0)

$UnsignedHigh = [System.BitConverter]::ToUInt32([System.BitConverter]::GetBytes($LastWrite.dwHighDateTime), 0)

# Shift high part so it is most significant 32 bits, then copy low part into 64-bit int:

$FileTimeInt64 = ([Int64] $UnsignedHigh -shl 32) -bor $UnsignedLow

# Create datetime object

[datetime]::FromFileTime($FileTimeInt64)

 

Notes

also see Notes in: C# – Return LastWriteTime Registry Key

C# – Return LastWriteTime Registry Key

email me

Compiled in Visual Studio 2017.

using System;
using System.Runtime.InteropServices;
using System.Text;

class RegTimestamp

{

// MAIN

static void Main()
{
// input
DateTime dTime = LastWriteTime(@"HKU\S-1-5-21-3492930481-2827506072-2794401122-1001\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\UserChoice");

// output
Console.Write(dTime + "\n");

// wait
Console.ReadKey();
}

// METHOD TO RETURN WRITE TIME

public static DateTime LastWriteTime(string regKey)
{
Query(regKey);
return DateTime.FromFileTime(lpftLastWriteTime);
}

// METHOD TO PROCESS INPUT

public static void Query(string regKey)
{

string[] hive = regKey.Split(new char[] { '\\' }, 2);
if (String.Equals(hive[0], "HKEY_LOCAL_MACHINE", StringComparison.OrdinalIgnoreCase) ||
String.Equals(hive[0], "HKLM", StringComparison.OrdinalIgnoreCase))
hKey = (UIntPtr)0x80000002;

else if (String.Equals(hive[0], "HKEY_CURRENT_USER", StringComparison.OrdinalIgnoreCase) ||
String.Equals(hive[0], "HKCU", StringComparison.OrdinalIgnoreCase))
hKey = (UIntPtr)0x80000001;

else if (String.Equals(hive[0], "HKEY_CLASSES_ROOT", StringComparison.OrdinalIgnoreCase) ||
String.Equals(hive[0], "HKCR", StringComparison.OrdinalIgnoreCase))
hKey = (UIntPtr)0x80000000;

else if (String.Equals(hive[0], "HKEY_USERS", StringComparison.OrdinalIgnoreCase) ||
String.Equals(hive[0], "HKU", StringComparison.OrdinalIgnoreCase))
hKey = (UIntPtr)0x80000003;

else if (String.Equals(hive[0], "HKEY_CURRENT_CONFIG", StringComparison.OrdinalIgnoreCase) ||
String.Equals(hive[0], "HKCC", StringComparison.OrdinalIgnoreCase))
hKey = (UIntPtr)0x80000005;

RegOpenKeyEx_DllImport(hKey, hive[1], 0, KEY_QUERY_VALUE, out hKeyVal);

RegQueryInfoKey(hKeyVal, classStr, ref classSize, IntPtr.Zero, out lpcSubKeys, out lpcbMaxSubKeyLen, out lpcbMaxClassLen, out lpcValues, out lpcbMaxValueNameLen, out lpcbMaxValueLen, out lpcbSecurityDescriptor, out lpftLastWriteTime);

}

// DLL IMPORTS - FOR INTEROPERABILITY

public const int KEY_QUERY_VALUE = 0x1;
static UIntPtr hKey = (UIntPtr)0x80000002;
static UIntPtr hKeyVal;
static StringBuilder classStr = new StringBuilder(255);
static uint classSize = (uint)classStr.Capacity + 1;
static uint lpcSubKeys;
static uint lpcbMaxSubKeyLen;
static uint lpcbMaxClassLen;
static uint lpcValues;
static uint lpcbMaxValueNameLen;
static uint lpcbMaxValueLen;
static uint lpcbSecurityDescriptor;
static long lpftLastWriteTime;

[DllImport("advapi32.dll", EntryPoint = "RegOpenKeyEx")]
extern private static int RegOpenKeyEx_DllImport(UIntPtr hKey, string lpSubKey, uint ulOptions, int samDesired, out UIntPtr phkResult);

[DllImport("advapi32.dll", CharSet = CharSet.Unicode, EntryPoint = "RegOpenKeyEx", SetLastError = true)]
public static extern int RegOpenKeyEx(UIntPtr hKey, string subKey, uint options, int sam, out UIntPtr phkResult);
public static UIntPtr HKEY_LOCAL_MACHINE = new UIntPtr(0x80000002u);
public static UIntPtr HKEY_CURRENT_USER = new UIntPtr(0x80000001u);
public static UIntPtr HKEY_USERS = (UIntPtr)0x80000003;
public static int KEY_SET_VALUE = 0x0002;
public static int KEY_CREATE_SUB_KEY = 0x0004;
public static int KEY_ENUMERATE_SUB_KEYS = 0x0008;
public static int KEY_WOW64_64KEY = 0x0100;
public static int KEY_WOW64_32KEY = 0x0200;

[DllImport("advapi32.dll", SetLastError = true)]
public static extern int RegCloseKey(UIntPtr hKey);

[DllImport("advapi32.dll")]
extern private static int RegQueryInfoKey(
UIntPtr hkey,
StringBuilder lpClass,
ref uint lpcbClass,
IntPtr lpReserved,
out uint lpcSubKeys,
out uint lpcbMaxSubKeyLen,
out uint lpcbMaxClassLen,
out uint lpcValues,
out uint lpcbMaxValueNameLen,
out uint lpcbMaxValueLen,
out uint lpcbSecurityDescriptor,
out long lpftLastWriteTime
);

}

 

Notes

ToFileTime()

Interoperability Overview (C# Programming Guide)

Consuming Unmanaged DLL Functions

Exposing COM Components to the .NET Framework

Calling Win32 DLLs in C#

Creating and Using DLL (Class Library) in C#


Functions in Advapi32.dll 

AuditLookupCategoryNameW 6.0 and higher documented
AuditLookupSubCategoryNameA 6.0 and higher documented
AuditLookupSubCategoryNameW 6.0 and higher documented
AuditQueryGlobalSaclA 6.1 and higher
AuditQueryGlobalSaclW 6.1 and higher
AuditQueryPerUserPolicy 6.0 and higher documented
AuditQuerySecurity 6.0 and higher documented
AuditQuerySystemPolicy 6.0 and higher documented
AuditSetGlobalSaclA 6.1 and higher
AuditSetGlobalSaclW 6.1 and higher
AuditSetPerUserPolicy 6.0 and higher documented
AuditSetSecurity 6.0 and higher documented
AuditSetSystemPolicy 6.0 and higher documented
BackupEventLogA 3.51 and higher documented
BackupEventLogW 3.51 and higher documented
BaseRegCloseKey 6.2 and higher
BaseRegCreateKey 6.2 and higher
BaseRegDeleteKeyEx 6.2 and higher
BaseRegDeleteValue 6.2 and higher
BaseRegFlushKey 6.2 and higher
BaseRegGetVersion 6.2 and higher
BaseRegLoadKey 6.2 and higher
BaseRegOpenKey 6.2 and higher
BaseRegRestoreKey 6.2 and higher
BaseRegSaveKeyEx 6.2 and higher
BaseRegSetKeySecurity 6.2 and higher
BaseRegSetValue 6.2 and higher
BaseRegUnLoadKey 6.2 and higher
BuildAccessRequestA 4.0 before Windows NT 4.0 SP4 (NT only)
BuildAccessRequestW 4.0 before Windows NT 4.0 SP4 (NT only)
BuildExplicitAccessWithNameA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildExplicitAccessWithNameW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildImpersonateExplicitAccessWithNameA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildImpersonateExplicitAccessWithNameW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildImpersonateTrusteeA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildImpersonateTrusteeW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildSecurityDescriptorA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildSecurityDescriptorW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildTrusteeWithNameA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildTrusteeWithNameW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildTrusteeWithObjectsAndNameA 5.0 and higher documented
BuildTrusteeWithObjectsAndNameW 5.0 and higher documented
BuildTrusteeWithObjectsAndSidA 5.0 and higher documented
BuildTrusteeWithObjectsAndSidW 5.0 and higher documented
BuildTrusteeWithSidA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
BuildTrusteeWithSidW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
CancelOverlappedAccess 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
ChangeServiceConfig2A 5.0 and higher documented
ChangeServiceConfig2W 5.0 and higher documented
ChangeServiceConfigA 3.51 and higher documented
ChangeServiceConfigW 3.51 and higher documented
CheckAppInitBlockedServiceIdentity 6.0 only
CheckForHiberboot 6.2 and higher
CheckTokenMembership 5.0 and higher documented
ClearEventLogA 3.51 and higher documented
ClearEventLogW 3.51 and higher documented
CloseCodeAuthzLevel 5.1 and higher
CloseEncryptedFileRaw 5.0 and higher documented
CloseEventLog 3.51 and higher documented
CloseServiceHandle 3.51 and higher documented
CloseThreadWaitChainSession 6.0 and higher documented
CloseTrace 5.0 and higher documented
CommandLineFromMsiDescriptor 5.0 and higher
ComputeAccessTokenFromCodeAuthzLevel 5.1 and higher
ControlService 3.51 and higher documented
ControlServiceExA 6.0 and higher documented
ControlServiceExW 6.0 and higher documented
ControlTraceA 5.0 and higher documented
ControlTraceW 5.0 and higher documented
ConvertAccessToSecurityDescriptorA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
ConvertAccessToSecurityDescriptorW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
ConvertSDToStringSDDomainW 6.2 and higher
ConvertSDToStringSDRootDomainA 5.0 and higher
ConvertSDToStringSDRootDomainW 5.0 and higher
ConvertSecurityDescriptorToAccessA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
ConvertSecurityDescriptorToAccessW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
ConvertSecurityDescriptorToAccessNamedA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
ConvertSecurityDescriptorToAccessNamedW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
ConvertSecurityDescriptorToStringSecurityDescriptorA 5.0 and higher documented
ConvertSecurityDescriptorToStringSecurityDescriptorW 5.0 and higher documented
ConvertSidToStringSidA 5.0 and higher documented
ConvertSidToStringSidW 5.0 and higher documented
ConvertStringSDToSDDomainA 5.1 and higher documented
ConvertStringSDToSDDomainW 5.1 and higher documented
ConvertStringSDToSDRootDomainA 5.0 and higher
ConvertStringSDToSDRootDomainW 5.0 and higher
ConvertStringSecurityDescriptorToSecurityDescriptorA 5.0 and higher documented
ConvertStringSecurityDescriptorToSecurityDescriptorW 5.0 and higher documented
ConvertStringSidToSidA 5.0 and higher documented
ConvertStringSidToSidW 5.0 and higher documented
ConvertToAutoInheritPrivateObjectSecurity 5.0 and higher documented
CopySid 3.51 and higher documented
CreateCodeAuthzLevel 5.1 and higher
CreatePrivateObjectSecurity 3.51 and higher documented
CreatePrivateObjectSecurityEx 5.0 and higher documented
CreatePrivateObjectSecurityWithMultipleInheritance 5.1 and higher documented
CreateProcessAsUserA 3.51 and higher documented
CreateProcessAsUserSecure some 5.0 and some 5.1 only;
5.0 from Windows 2000 SP4;
5.1 from Windows XP SP2 and SP3
CreateProcessAsUserW 3.51 and higher documented
CreateProcessWithLogonW 5.0 and higher documented
CreateProcessWithTokenW 5.2 and higher documented
CreateRestrictedToken 5.0 and higher documented
CreateServiceA 3.51 and higher documented
CreateServiceW 3.51 and higher documented
CreateTraceInstanceId 5.0 and higher documented
CreateWellKnownSid 5.0 from Windows 2000 SP2, and higher documented
CredBackupCredentials 6.0 and higher
CredDeleteA 5.1 and higher documented
CredDeleteW 5.1 and higher documented
CredEncryptAndMarshalBinaryBlob 6.0 and higher
CredEnumerateA 5.1 and higher documented
CredEnumerateW 5.1 and higher documented
CredFindBestCredentialA 6.0 and higher documented
CredFindBestCredentialW 6.0 and higher documented
CredFree 5.1 and higher documented
CredGetSessionTypes 5.1 and higher documented
CredGetTargetInfoA 5.1 and higher documented
CredGetTargetInfoW 5.1 and higher documented
CredIsMarshaledCredentialA 5.1 and higher documented
CredIsMarshaledCredentialW 5.1 and higher documented
CredIsProtectedA 6.0 and higher documented
CredIsProtectedW 6.0 and higher documented
CredMarshalCredentialA 5.1 and higher documented
CredMarshalCredentialW 5.1 and higher documented
CredProfileLoaded 5.1 and higher
CredProfileLoadedEx 6.2 and higher
CredProfileUnloaded 6.0 and higher
CredProtectA 6.0 and higher documented
CredProtectW 6.0 and higher documented
CredReadA 5.1 and higher documented
CredReadByTokenHandle 6.0 and higher
CredReadDomainCredentialsA 5.1 and higher documented
CredReadDomainCredentialsW 5.1 and higher documented
CredReadW 5.1 and higher documented
CredRenameA 5.1 and higher documented
CredRenameW 5.1 and higher documented
CredRestoreCredentials 6.0 and higher
CredUnmarshalCredentialA 5.1 and higher documented
CredUnmarshalCredentialW 5.1 and higher documented
CredUnprotectA 6.0 and higher documented
CredUnprotectW 6.0 and higher documented
CredWriteA 5.1 and higher documented
CredWriteDomainCredentialsA 5.1 and higher documented
CredWriteDomainCredentialsW 5.1 and higher documented
CredWriteW 5.1 and higher documented
CredpConvertCredential 5.1 and higher
CredpConvertOneCredentialSize 6.0 and higher
CredpConvertTargetInfo 5.1 and higher
CredpDecodeCredential 5.1 and higher
CredpEncodeCredential 5.1 and higher
CredpEncodeSecret 6.0 and higher
CryptAcquireContextA 4.0 from Windows NT 4.0, and higher documented
CryptAcquireContextW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
CryptContextAddRef 4.80 and higher documented
CryptCreateHash 4.0 from Windows NT 4.0, and higher documented
CryptDecrypt 4.0 from Windows NT 4.0, and higher documented
CryptDeriveKey 4.0 from Windows NT 4.0, and higher documented
CryptDestroyHash 4.0 from Windows NT 4.0, and higher documented
CryptDestroyKey 4.0 from Windows NT 4.0, and higher documented
CryptDuplicateHash 4.80 and higher documented
CryptDuplicateKey 4.80 and higher documented
CryptEncrypt 4.0 from Windows NT 4.0, and higher documented
CryptEnumProviderTypesA 4.80 and higher documented
CryptEnumProviderTypesW 4.80 and higher documented
CryptEnumProvidersA 4.80 and higher documented
CryptEnumProvidersW 4.80 and higher documented
CryptExportKey 4.0 from Windows NT 4.0, and higher documented
CryptGenKey 4.0 from Windows NT 4.0, and higher documented
CryptGenRandom 4.0 from Windows NT 4.0, and higher documented
CryptGetDefaultProviderA 4.80 and higher documented
CryptGetDefaultProviderW 4.80 and higher documented
CryptGetHashParam 4.0 from Windows NT 4.0, and higher documented
CryptGetKeyParam 4.0 from Windows NT 4.0, and higher documented
CryptGetLocalKeyLimits 4.90 only documented
CryptGetProvParam 4.0 from Windows NT 4.0, and higher documented
CryptGetUserKey 4.0 from Windows NT 4.0, and higher documented
CryptHashData 4.0 from Windows NT 4.0, and higher documented
CryptHashSessionKey 4.0 from Windows NT 4.0, and higher documented
CryptImportKey 4.0 from Windows NT 4.0, and higher documented
CryptReleaseContext 4.0 from Windows NT 4.0, and higher documented
CryptSetHashParam 4.0 from Windows NT 4.0, and higher documented
CryptSetKeyParam 4.0 from Windows NT 4.0, and higher documented
CryptSetProvParam 4.0 from Windows NT 4.0, and higher documented
CryptSetProviderA 4.0 from Windows NT 4.0, and higher documented
CryptSetProviderExA 4.80 and higher documented
CryptSetProviderExW 4.80 and higher documented
CryptSetProviderW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
CryptSignHashA 4.0 from Windows NT 4.0, and higher documented
CryptSignHashW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
CryptVerifySignatureA 4.0 from Windows NT 4.0, and higher documented
CryptVerifySignatureW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
DecryptFileA 5.0 and higher documented
DecryptFileW 5.0 and higher documented
DeleteAce 3.51 and higher documented
DeleteService 3.51 and higher documented
DenyAccessRightsA 4.0 before Windows NT 4.0 SP4 (NT only)
DenyAccessRightsW 4.0 before Windows NT 4.0 SP4 (NT only)
DeregisterEventSource 3.51 and higher documented
DestroyPrivateObjectSecurity 3.51 and higher documented
DuplicateEncryptionInfoFile 5.0 and higher documented
DuplicateToken 3.51 and higher documented
DuplicateTokenEx 4.0 and higher (NT);
4.80 and higher (Windows)
documented
ElfBackupEventLogFileA 3.51 and higher (NT only)
ElfBackupEventLogFileW 3.51 and higher (NT only)
ElfChangeNotify 3.51 and higher (NT only)
ElfClearEventLogFileA 3.51 and higher (NT only)
ElfClearEventLogFileW 3.51 and higher (NT only)
ElfCloseEventLog 3.51 and higher (NT only)
ElfDeregisterEventSource 3.51 and higher (NT only)
ElfFlushEventLog some 5.0, some 5.1, and higher;
5.0 from Windows 2000 SP4;
5.1 from Windows XP SP2 and SP3
ElfNumberOfRecords 3.51 and higher (NT only)
ElfOldestRecord 3.51 and higher (NT only)
ElfOpenBackupEventLogA 3.51 and higher (NT only)
ElfOpenBackupEventLogW 3.51 and higher (NT only)
ElfOpenEventLogA 3.51 and higher (NT only)
ElfOpenEventLogW 3.51 and higher (NT only)
ElfReadEventLogA 3.51 and higher (NT only)
ElfReadEventLogW 3.51 and higher (NT only)
ElfRegisterEventSourceA 3.51 and higher (NT only)
ElfRegisterEventSourceW 3.51 and higher (NT only)
ElfReportEventA 3.51 and higher (NT only)
ElfReportEventAndSourceW 5.2 from Windows Server 2003 SP1, and higher
ElfReportEventW 3.51 and higher (NT only)
EnableTrace 5.0 and higher documented
EnableTraceEx 6.0 and higher documented
EnableTraceEx2 6.1 and higher documented
EncryptedFileKeyInfo 5.1 and higher
EncryptFileA 5.0 and higher documented
EncryptFileW 5.0 and higher documented
EncryptionDisable 5.0 and higher documented
EnumDependentServicesA 3.51 and higher documented
EnumDependentServicesW 3.51 and higher documented
EnumDynamicTimeZoneInformation 6.2 and higher
EnumServiceGroupW 4.0 and higher (NT only)
EnumServicesStatusA 3.51 and higher documented
EnumServicesStatusExA 4.0 from Windows NT 4.0 SP4, and higher (NT only) documented
EnumServicesStatusExW 4.0 from Windows NT 4.0 SP4, and higher (NT only) documented
EnumServicesStatusW 3.51 and higher documented
EnumerateTraceGuids 5.1 and higher documented
EnumerateTraceGuidsEx 6.0 and higher documented
EqualDomainSid 5.0 from Windows 2000 SP2, and higher documented
EqualPrefixSid 3.51 and higher documented
EqualSid 3.51 and higher documented
EtwLogSysConfigExtension 6.2 and higher
EventAccessControl 6.0 and higher documented
EventAccessQuery 6.0 and higher documented
EventAccessRemove 6.0 and higher documented
EventActivityIdControl 6.0 and higher documented
EventEnabled 6.0 and higher documented
EventProviderEnabled 6.0 and higher documented
EventRegister 6.0 and higher documented
EventSetInformation 6.2 and higher
EventUnregister 6.0 and higher documented
EventWrite 6.0 and higher documented
EventWriteEndScenario 6.0 and higher
EventWriteEx 6.1 and higher documented
EventWriteStartScenario 6.0 and higher
EventWriteString 6.0 and higher documented
EventWriteTransfer 6.0 and higher documented
FileEncryptionStatusA 5.0 and higher documented
FileEncryptionStatusW 5.0 and higher documented
FindFirstFreeAce 3.51 and higher documented
FlushEfsCache 6.0 and higher
FlushTraceA 5.1 and higher documented
FlushTraceW 5.1 and higher documented
FreeEncryptedFileKeyInfo 5.1 and higher
FreeEncryptedFileMetadata 6.0 and higher
FreeEncryptionCertificateHashList 5.0 and higher documented
FreeInheritedFromArray 5.1 and higher documented
FreeSid 3.51 and higher documented
GetAccessPermissionsForObjectA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
GetAccessPermissionsForObjectW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
GetAce 3.51 and higher documented
GetAclInformation 3.51 and higher documented
GetAuditedPermissionsFromAclA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetAuditedPermissionsFromAclW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetAuditedPermissionsFromSDA 4.0 before Windows NT 4.0 SP4 (NT only)
GetAuditedPermissionsFromSDW 4.0 before Windows NT 4.0 SP4 (NT only)
GetCurrentHwProfileA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetCurrentHwProfileW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetDynamicTimeZoneInformationEffectiveYears 6.2 and higher
GetEffectiveAccessRightsA 4.0 before Windows NT 4.0 SP4 (NT only)
GetEffectiveAccessRightsW 4.0 before Windows NT 4.0 SP4 (NT only)
GetEffectiveRightsFromAclA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetEffectiveRightsFromAclW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetEffectiveRightsFromSDA 4.0 before Windows NT 4.0 SP4 (NT only)
GetEffectiveRightsFromSDW 4.0 before Windows NT 4.0 SP4 (NT only)
GetEncryptedFileMetadata 6.0 and higher
GetEventLogInformation 5.0 and higher documented
GetExplicitAccessRightsA 4.0 before Windows NT 4.0 SP4 (NT only)
GetExplicitAccessRightsW 4.0 before Windows NT 4.0 SP4 (NT only)
GetExplicitEntriesFromAclA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetExplicitEntriesFromAclW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetFileSecurityA 3.51 and higher documented
GetFileSecurityW 3.51 and higher documented
GetInformationCodeAuthzLevelW 5.1 and higher
GetInformationCodeAuthzPolicyW 5.1 and higher
GetInheritanceSourceA 5.1 and higher documented
GetInheritanceSourceW 5.1 and higher documented
GetKernelObjectSecurity 3.51 and higher documented
GetLengthSid 3.51 and higher documented
GetLocalManagedApplicationData 5.1 and higher
GetLocalManagedApplications 5.0 and higher documented
GetManagedApplicationCategories 5.1 and higher documented
GetManagedApplications 5.0 and higher documented
GetMangledSiteSid 5.0 only
GetMultipleTrusteeA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetMultipleTrusteeOperationA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetMultipleTrusteeOperationW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetMultipleTrusteeW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetNamedSecurityInfoA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetNamedSecurityInfoExA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
GetNamedSecurityInfoExW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
GetNamedSecurityInfoW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetNumberOfEventLogRecords 3.51 and higher documented
GetOldestEventLogRecord 3.51 and higher documented
GetOverlappedAccessResults 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
GetPrivateObjectSecurity 3.51 and higher documented
GetSecurityDescriptorControl 3.51 and higher documented
GetSecurityDescriptorDacl 3.51 and higher documented
GetSecurityDescriptorGroup 3.51 and higher documented
GetSecurityDescriptorLength 3.51 and higher documented
GetSecurityDescriptorOwner 3.51 and higher documented
GetSecurityDescriptorRMControl 5.0 and higher documented
GetSecurityDescriptorSacl 3.51 and higher documented
GetSecurityInfo 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetSecurityInfoExA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
GetSecurityInfoExW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
GetServiceDisplayNameA 3.51 and higher documented
GetServiceDisplayNameW 3.51 and higher documented
GetServiceKeyNameA 3.51 and higher documented
GetServiceKeyNameW 3.51 and higher documented
GetSidIdentifierAuthority 3.51 and higher documented
GetSidLengthRequired 3.51 and higher documented
GetSidSubAuthority 3.51 and higher documented
GetSidSubAuthorityCount 3.51 and higher documented
GetSiteDirectoryA 5.0 only
GetSiteDirectoryW 5.0 only
GetSiteNameFromSid 5.0 only
GetSiteSidFromToken 5.0 only
GetSiteSidFromUrl 5.0 only
GetStringConditionFromBinary 6.2 and higher
GetThreadWaitChain 6.0 and higher documented
GetTokenInformation 3.51 and higher documented
GetTraceEnableFlags 5.0 and higher documented
GetTraceEnableLevel 5.0 and higher documented
GetTraceLoggerHandle 5.0 and higher documented
GetTrusteeFormA 5.0 and higher documented
GetTrusteeFormW 5.0 and higher documented
GetTrusteeNameA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetTrusteeNameW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetTrusteeTypeA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetTrusteeTypeW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
GetUserNameA 3.51 and higher documented
GetUserNameW 3.51 and higher documented
GetWindowsAccountDomainSid 5.0 from Windows 2000 SP2, and higher documented
GrantAccessRightsA 4.0 before Windows NT 4.0 SP4 (NT only)
GrantAccessRightsW 4.0 before Windows NT 4.0 SP4 (NT only)
I_QueryTagInformation 5.2 from Windows Server 2003 SP1, and higher
I_ScGetCurrentGroupStateW 4.0 and higher (NT only)
I_ScIsSecurityProcess 5.0 and higher
I_ScPnPGetServiceName 5.0 and higher
I_ScQueryServiceConfig 6.0 and higher
I_ScRegisterPreshutdownRestart 6.2 and higher
I_ScSendPnPMessage 6.0 and higher
I_ScSendTSMessage 5.1 and higher
I_ScSetServiceBitsA 3.51 and higher (NT only)
I_ScSetServiceBitsW 3.51 and higher (NT only)
I_ScValidatePnPService 6.0 and higher
IdentifyCodeAuthzLevelW 5.1 and higher
ImpersonateAnonymousToken 5.0 and higher documented
ImpersonateLoggedOnUser 3.51 and higher documented
ImpersonateNamedPipeClient 3.51 and higher documented
ImpersonateSelf 3.51 and higher documented
InitializeAcl 3.51 and higher documented
InitializeSecurityDescriptor 3.51 and higher documented
InitializeSid 3.51 and higher documented
InitiateShutdownA 6.0 and higher documented
InitiateShutdownW 6.0 and higher documented
InitiateSystemShutdownA 3.51 and higher documented
InitiateSystemShutdownExA 5.0 and higher documented
InitiateSystemShutdownExW 5.0 and higher documented
InitiateSystemShutdownW 3.51 and higher documented
InstallApplication 5.0 and higher documented
IsAccessPermittedA 4.0 before Windows NT 4.0 SP4 (NT only)
IsAccessPermittedW 4.0 before Windows NT 4.0 SP4 (NT only)
IsInSandbox 5.0 only
IsProcessRestricted 5.0 only
IsTextUnicode 3.51 and higher documented
IsTokenRestricted 5.0 and higher documented
IsTokenUntrusted 5.1 and higher
IsValidAcl 3.51 and higher documented
IsValidRelativeSecurityDescriptor 6.0 and higher
IsValidSecurityDescriptor 3.51 and higher documented
IsValidSid 3.51 and higher documented
IsWellKnownSid 5.0 from Windows 2000 SP2, and higher documented
LockServiceDatabase 3.51 and higher documented
LogonUserA 3.51 and higher documented
LogonUserExA 5.1 and higher documented
LogonUserExExW 6.0 and higher documented
LogonUserExW 5.1 and higher documented
LogonUserW 3.51 and higher documented
LookupAccountNameA 3.51 and higher documented
LookupAccountNameW 3.51 and higher documented
LookupAccountSidA 3.51 and higher documented
LookupAccountSidW 3.51 and higher documented
LookupPrivilegeDisplayNameA 3.51 and higher documented
LookupPrivilegeDisplayNameW 3.51 and higher documented
LookupPrivilegeNameA 3.51 and higher documented
LookupPrivilegeNameW 3.51 and higher documented
LookupPrivilegeValueA 3.51 and higher documented
LookupPrivilegeValueW 3.51 and higher documented
LookupSecurityDescriptorPartsA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
LookupSecurityDescriptorPartsW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
LsaAddAccountRights 3.51 and higher (NT only) documented
LsaAddPrivilegesToAccount 3.51 and higher (NT only)
LsaClearAuditLog 3.51 and higher (NT only)
LsaClose 3.51 and higher (NT only) documented
LsaCreateAccount 3.51 and higher (NT only)
LsaCreateSecret 3.51 and higher (NT only)
LsaCreateTrustedDomain 3.51 and higher (NT only) documented
LsaCreateTrustedDomainEx 5.0 and higher documented
LsaDelete 3.51 and higher (NT only)
LsaDeleteTrustedDomain 3.51 and higher (NT only) documented
LsaEnumerateAccountRights 3.51 and higher (NT only) documented
LsaEnumerateAccounts 3.51 and higher (NT only)
LsaEnumerateAccountsWithUserRight 3.51 and higher (NT only) documented
LsaEnumeratePrivileges 3.51 and higher (NT only)
LsaEnumeratePrivilegesOfAccount 3.51 and higher (NT only)
LsaEnumerateTrustedDomains 3.51 and higher (NT only) documented
LsaEnumerateTrustedDomainsEx 5.0 and higher documented
LsaFreeMemory 3.51 and higher (NT only) documented
LsaGetAppliedCAPIDs 6.2 and higher
LsaGetQuotasForAccount 3.51 and higher (NT only)
LsaGetRemoteUserName 4.0 from Windows NT 4.0 SP4, and higher (NT only)
LsaGetSystemAccessAccount 3.51 and higher (NT only)
LsaGetUserName 4.0 and higher (NT only)
LsaICLookupNames 3.51 and higher (NT only)
LsaICLookupNamesWithCreds 5.1 and higher
LsaICLookupSids 3.51 and higher (NT only)
LsaICLookupSidsWithCreds 5.1 and higher
LsaLookupNames 3.51 and higher (NT only) documented
LsaLookupNames2 5.1 and higher documented
LsaLookupPrivilegeDisplayName 3.51 and higher (NT only)
LsaLookupPrivilegeName 3.51 and higher (NT only)
LsaLookupPrivilegeValue 3.51 and higher (NT only)
LsaLookupSids 3.51 and higher (NT only) documented
LsaLookupSids2 6.2 and higher
LsaManageSidNameMapping 6.0 and higher
LsaNtStatusToWinError 3.51 and higher (NT only) documented
LsaOpenAccount 3.51 and higher (NT only)
LsaOpenPolicy 3.51 and higher (NT only) documented
LsaOpenPolicySce 5.0 from Windows 2000 SP2, and higher
LsaOpenSecret 3.51 and higher (NT only)
LsaOpenTrustedDomain 3.51 and higher (NT only)
LsaOpenTrustedDomainByName 5.0 and higher documented
LsaQueryCAPs 6.2 and higher
LsaQueryDomainInformationPolicy 5.0 and higher documented
LsaQueryForestTrustInformation 5.1 and higher documented
LsaQueryInfoTrustedDomain 3.51 and higher (NT only)
LsaQueryInformationPolicy 3.51 and higher (NT only) documented
LsaQuerySecret 3.51 and higher (NT only)
LsaQuerySecurityObject 3.51 and higher (NT only)
LsaQueryTrustedDomainInfo 3.51 and higher (NT only) documented
LsaQueryTrustedDomainInfoByName 5.0 and higher documented
LsaRemoveAccountRights 3.51 and higher (NT only) documented
LsaRemovePrivilegesFromAccount 3.51 and higher (NT only)
LsaRetrievePrivateData 3.51 and higher (NT only) documented
LsaSetCAPs 6.2 and higher
LsaSetDomainInformationPolicy 5.0 and higher documented
LsaSetForestTrustInformation 5.1 and higher documented
LsaSetInformationPolicy 3.51 and higher (NT only) documented
LsaSetInformationTrustedDomain 3.51 and higher (NT only)
LsaSetQuotasForAccount 3.51 and higher NT only)
LsaSetSecret 3.51 and higher (NT only)
LsaSetSecurityObject 3.51 and higher (NT only)
LsaSetSystemAccessAccount 3.51 and higher (NT only)
LsaSetTrustedDomainInfoByName 5.0 and higher documented
LsaSetTrustedDomainInformation 3.51 and higher (NT only) documented
LsaStorePrivateData 3.51 and higher (NT only) documented
MD4Final 5.1 and higher
MD4Init 5.1 and higher
MD4Update 5.1 and higher
MD5Final 5.1 and higher
MD5Init 5.1 and higher
MD5Update 5.1 and higher
MIDL_user_free_Ext 6.2 and higher
MSChapSrvChangePassword 5.1 and higher documented
MSChapSrvChangePassword2 5.1 and higher documented
MakeAbsoluteSD 3.51 and higher documented
MakeAbsoluteSD2 5.0 and higher
MakeSelfRelativeSD 3.51 and higher documented
MapGenericMask 3.51 and higher documented
NTAccessMaskToProvAccessRights 4.0 before Windows NT 4.0 SP4 (NT only)
NotifyBootConfigStatus 3.51 and higher documented
NotifyChangeEventLog 3.51 and higher documented
NotifyServiceStatusChange 6.0 and higher documented
NotifyServiceStatusChangeA 6.0 and higher documented
NotifyServiceStatusChangeW 6.0 and higher documented
NpGetUserName 10.0 and higher
ObjectCloseAuditAlarmA 3.51 and higher documented
ObjectCloseAuditAlarmW 3.51 and higher documented
ObjectDeleteAuditAlarmA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
ObjectDeleteAuditAlarmW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
ObjectOpenAuditAlarmA 3.51 and higher documented
ObjectOpenAuditAlarmW 3.51 and higher documented
ObjectPrivilegeAuditAlarmA 3.51 and higher documented
ObjectPrivilegeAuditAlarmW 3.51 and higher documented
OpenBackupEventLogA 3.51 and higher documented
OpenBackupEventLogW 3.51 and higher documented
OpenEncryptedFileRawA 5.0 and higher documented
OpenEncryptedFileRawW 5.0 and higher documented
OpenEventLogA 3.51 and higher documented
OpenEventLogW 3.51 and higher documented
OpenProcessToken 3.51 and higher documented
OpenSCManagerA 3.51 and higher documented
OpenSCManagerW 3.51 and higher documented
OpenServiceA 3.51 and higher documented
OpenServiceW 3.51 and higher documented
OpenThreadToken 3.51 and higher documented
OpenThreadWaitChainSession 6.0 and higher documented
OpenTraceA 5.0 and higher documented
OpenTraceW 5.0 and higher documented
OperationEnd 6.2 and higher
OperationStart 6.2 and higher
PerfAddCounters 6.0 and higher
PerfCloseQueryHandle 6.0 and higher
PerfCreateInstance 6.0 and higher documented
PerfDecrementULongCounterValue 6.0 and higher documented
PerfDecrementULongLongCounterValue 6.0 and higher documented
PerfDeleteCounters 6.0 and higher
PerfDeleteInstance 6.0 and higher documented
PerfEnumerateCounterSet 6.0 and higher
PerfEnumerateCounterSetInstances 6.0 and higher
PerfIncrementULongCounterValue 6.0 and higher documented
PerfIncrementULongLongCounterValue 6.0 and higher documented
PerfOpenQueryHandle 6.0 and higher
PerfQueryCounterData 6.0 and higher
PerfQueryCounterInfo 6.0 and higher
PerfQueryCounterSetRegistrationInfo 6.0 and higher
PerfQueryInstance 6.0 and higher documented
PerfRegCloseKey 6.2 and higher
PerfRegEnumKey 6.2 and higher
PerfRegEnumValue 6.2 and higher
PerfRegQueryInfoKey 6.2 and higher
PerfRegQueryValue 6.2 and higher
PerfRegSetValue 6.2 and higher
PerfSetCounterRefValue 6.0 and higher documented
PerfSetCounterSetInfo 6.0 and higher documented
PerfSetULongCounterValue 6.0 and higher documented
PerfSetULongLongCounterValue 6.0 and higher documented
PerfStartProvider 6.0 and higher documented
PerfStartProviderEx 6.0 and higher documented
PerfStopProvider 6.0 and higher documented
PrivilegeCheck 3.51 and higher documented
PrivilegedServiceAuditAlarmA 3.51 and higher documented
PrivilegedServiceAuditAlarmW 3.51 and higher documented
ProcessIdleTasks 5.1 and higher
ProcessIdleTasksW 6.0 and higher
ProcessTrace 5.0 and higher documented
ProvAccessRightsToNTAccessMask 4.0 before Windows NT 4.0 SP4 (NT only)
PsmActivateApplication 6.2 only
PsmAdjustActivationToken 6.2 only
PsmQueryBackgroundActivationType 6.2 only
PsmRegisterApplicationProcess 6.2 only
QueryAllTracesA 5.0 and higher documented
QueryAllTracesW 5.0 and higher documented
QueryRecoveryAgentsOnEncryptedFile 5.0 and higher documented
QuerySecurityAccessMask 6.0 and higher documented
QueryServiceConfig2A 5.0 and higher documented
QueryServiceConfig2W 5.0 and higher documented
QueryServiceConfigA 3.51 and higher documented
QueryServiceConfigW 3.51 and higher documented
QueryServiceDynamicInformation 6.2 and higher
QueryServiceLockStatusA 3.51 and higher documented
QueryServiceLockStatusW 3.51 and higher documented
QueryServiceObjectSecurity 3.51 and higher documented
QueryServiceStatus 3.51 and higher documented
QueryServiceStatusEx 4.0 and higher (NT only) documented
QueryTraceA 5.1 and higher documented
QueryTraceW 5.1 and higher documented
QueryUsersOnEncryptedFile 5.0 and higher documented
QueryWindows31FilesMigration 3.51 to 5.1 (NT only)
ReadEncryptedFileRaw 5.0 and higher documented
ReadEventLogA 3.51 and higher documented
ReadEventLogW 3.51 and higher documented
RegCloseKey 3.51 and higher documented
RegConnectRegistryA 3.51 and higher documented
RegConnectRegistryW 3.51 and higher documented
RegConnectRegistryExA 5.2 from Windows Server 2003 SP1, and higher
RegConnectRegistryExW 5.2 from Windows Server 2003 SP1, and higher
RegCopyTreeA 6.0 and higher documented
RegCopyTreeW 6.0 and higher documented
RegCreateKeyA 3.51 and higher documented
RegCreateKeyExA 3.51 and higher documented
RegCreateKeyExW 3.51 and higher documented
RegCreateKeyTransactedA 6.0 and higher documented
RegCreateKeyTransactedW 6.0 and higher documented
RegCreateKeyW 3.51 and higher documented
RegDeleteKeyA 3.51 and higher documented
RegDeleteKeyExA 5.2 from Windows Server 2003 SP1, and higher documented
RegDeleteKeyExW 5.2 from Windows Server 2003 SP1, and higher documented
RegDeleteKeyTransactedA 6.0 and higher documented
RegDeleteKeyTransactedW 6.0 and higher documented
RegDeleteKeyValueA 6.0 and higher documented
RegDeleteKeyValueW 6.0 and higher documented
RegDeleteKeyW 3.51 and higher documented
RegDeleteTreeA 6.0 and higher documented
RegDeleteTreeW 6.0 and higher documented
RegDeleteValueA 3.51 and higher documented
RegDeleteValueW 3.51 and higher documented
RegDisablePredefinedCache 5.0 and higher documented
RegDisablePredefinedCacheEx 5.1 from Windows XP SP3, and 6.0 and higher documented
RegDisableReflectionKey 5.2 from Windows Server 2003 SP1, and higher documented
RegEnableReflectionKey 5.2 from Windows Server 2003 SP1, and higher documented
RegEnumKeyA 3.51 and higher documented
RegEnumKeyExA 3.51 and higher documented
RegEnumKeyExW 3.51 and higher documented
RegEnumKeyW 3.51 and higher documented
RegEnumValueA 3.51 and higher documented
RegEnumValueW 3.51 and higher documented
RegFlushKey 3.51 and higher documented
RegGetKeySecurity 3.51 and higher documented
RegGetValueA 5.2 from Windows Server 2003 SP1, and higher documented
RegGetValueW 5.2 from Windows Server 2003 SP1, and higher documented
RegLoadAppKeyA 6.0 and higher documented
RegLoadAppKeyW 6.0 and higher documented
RegLoadKeyA 3.51 and higher documented
RegLoadKeyW 3.51 and higher documented
RegLoadMUIStringA 6.0 and higher documented
RegLoadMUIStringW 6.0 and higher documented
RegNotifyChangeKeyValue 3.51 and higher documented
RegOpenCurrentUser 5.0 and higher documented
RegOpenKeyA 3.51 and higher documented
RegOpenKeyExA 3.51 and higher documented
RegOpenKeyExW 3.51 and higher documented
RegOpenKeyTransactedA 6.0 and higher documented
RegOpenKeyTransactedW 6.0 and higher documented
RegOpenKeyW 3.51 and higher documented
RegOpenUserClassesRoot 5.0 and higher documented
RegOverridePredefKey 5.0 and higher documented
RegQueryInfoKeyA 3.51 and higher documented
RegQueryInfoKeyW 3.51 and higher documented
RegQueryMultipleValuesA 3.51 and higher documented
RegQueryMultipleValuesW 3.51 and higher documented
RegQueryReflectionKey 5.2 from Windows Server 2003 SP1, and higher documented
RegQueryValueA 3.51 and higher documented
RegQueryValueExA 3.51 and higher documented
RegQueryValueExW 3.51 and higher documented
RegQueryValueW 3.51 and higher documented
RegRemapPreDefKey 4.0 to 4.90 (Windows only)
RegRenameKey 6.0 and higher
RegReplaceKeyA 3.51 and higher documented
RegReplaceKeyW 3.51 and higher documented
RegRestoreKeyA 3.51 and higher documented
RegRestoreKeyW 3.51 and higher documented
RegSaveKeyA 3.51 and higher documented
RegSaveKeyExA 5.1 and higher documented
RegSaveKeyExW 5.1 and higher documented
RegSaveKeyW 3.51 and higher documented
RegSetKeySecurity 3.51 and higher documented
RegSetKeyValueA 6.0 and higher documented
RegSetKeyValueW 6.0 and higher documented
RegSetValueA 3.51 and higher documented
RegSetValueExA 3.51 and higher documented
RegSetValueExW 3.51 and higher documented
RegSetValueW 3.51 and higher documented
RegUnLoadKeyA 3.51 and higher documented
RegUnLoadKeyW 3.51 and higher documented
RegisterEventSourceA 3.51 and higher documented
RegisterEventSourceW 3.51 and higher documented
RegisterIdleTask 5.1 and higher
RegisterServiceCtrlHandlerA 3.51 and higher documented
RegisterServiceCtrlHandlerExA 5.0 and higher documented
RegisterServiceCtrlHandlerExW 5.0 and higher documented
RegisterServiceCtrlHandlerW 3.51 and higher documented
RegisterTraceGuidsA 5.0 and higher documented
RegisterTraceGuidsW 5.0 and higher documented
RegisterWaitChainCOMCallback 6.0 and higher documented
RemoteRegEnumKeyWrapper 6.2 and higher
RemoteRegEnumValueWrapper 6.2 and higher
RemoteRegQueryInfoKeyWrapper 6.2 and higher
RemoteRegQueryValueWrapper 6.2 and higher
RemoveTraceCallback 5.0 and higher documented
RemoveUsersFromEncryptedFile 5.0 and higher documented
ReplaceAllAccessRightsA 4.0 before Windows NT 4.0 SP4 (NT only)
ReplaceAllAccessRightsW 4.0 before Windows NT 4.0 SP4 (NT only)
ReportEventA 3.51 and higher documented
ReportEventW 3.51 and higher documented
RevertToSelf 3.51 and higher documented
RevokeExplicitAccessRightsA 4.0 before Windows NT 4.0 SP4 (NT only)
RevokeExplicitAccessRightsW 4.0 before Windows NT 4.0 SP4 (NT only)
SafeBaseRegGetKeySecurity 6.2 and higher
SaferCloseLevel 5.1 and higher documented
SaferComputeTokenFromLevel 5.1 and higher documented
SaferCreateLevel 5.1 and higher documented
SaferGetLevelInformation 5.1 and higher documented
SaferGetPolicyInformation 5.1 and higher documented
SaferIdentifyLevel 5.1 and higher documented
SaferRecordEventLogEntry 5.1 and higher documented
SaferSetLevelInformation 5.1 and higher
SaferSetPolicyInformation 5.1 and higher
SaferiChangeRegistryScope 5.1 and higher
SaferiCompareTokenLevels 5.1 and higher
SaferiIsDllAllowed 6.1 and higher
SaferiIsExecutableFileType 5.1 and higher documented
SaferiPopulateDefaultsInRegistry 5.1 and higher
SaferiRecordEventLogEntry 5.1 and higher
SaferiRegisterExtensionDll (1000) 6.1 and higher
SaferiReplaceProcessThreadTokens 5.1 to 6.0
SaferiSearchMatchingHashRules 5.1 and higher
SetAccessRightsA 4.0 before Windows NT 4.0 SP4 (NT only)
SetAccessRightsW 4.0 before Windows NT 4.0 SP4 (NT only)
SetAclInformation 3.51 and higher documented
SetEncryptedFileMetadata 6.0 and higher
SetEntriesInAccessListA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
SetEntriesInAccessListW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
SetEntriesInAclA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
SetEntriesInAclW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
SetEntriesInAuditListA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
SetEntriesInAuditListW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
SetFileSecurityA 3.51 and higher documented
SetFileSecurityW 3.51 and higher documented
SetInformationCodeAuthzLevelW 5.1 and higher
SetInformationCodeAuthzPolicyW 5.1 and higher
SetKernelObjectSecurity 3.51 and higher documented
SetNamedSecurityInfoA 4.0 and higher (NT);
4.80 and higher (Windows)
documented
SetNamedSecurityInfoExA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
SetNamedSecurityInfoExW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
SetNamedSecurityInfoW 4.0 and higher (NT);
4.80 and higher (Windows)
documented
SetPrivateObjectSecurity 3.51 and higher documented
SetPrivateObjectSecurityEx 5.0 and higher documented
SetSecurityAccessMask 6.0 and higher documented
SetSecurityDescriptorControl 5.0 and higher documented
SetSecurityDescriptorDacl 3.51 and higher documented
SetSecurityDescriptorGroup 3.51 and higher documented
SetSecurityDescriptorOwner 3.51 and higher documented
SetSecurityDescriptorRMControl 5.0 and higher documented
SetSecurityDescriptorSacl 3.51 and higher documented
SetSecurityInfo 4.0 and higher (NT);
4.80 and higher (Windows)
documented
SetSecurityInfoExA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
SetSecurityInfoExW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
SetServiceBits 3.51 and higher documented
SetServiceObjectSecurity 3.51 and higher documented
SetServiceStatus 3.51 and higher documented
SetThreadToken 3.51 and higher documented
SetTokenInformation 3.51 and higher documented
SetTraceCallback 5.0 and higher documented
SetUserFileEncryptionKey 5.0 and higher documented
SetUserFileEncryptionKeyEx 6.0 and higher
StartServiceA 3.51 and higher documented
StartServiceCtrlDispatcherA 3.51 and higher documented
StartServiceCtrlDispatcherW 3.51 and higher documented
StartServiceW 3.51 and higher documented
StartTraceA 5.0 and higher documented
StartTraceW 5.0 and higher documented
StopTraceA 5.1 and higher documented
StopTraceW 5.1 and higher documented
SynchronizeWindows31FilesAndWindowsNTRegistry 3.51 to 5.1 (NT only)
SystemFunction001 3.51 and higher (NT only)
SystemFunction002 3.51 and higher (NT only)
SystemFunction003 3.51 and higher (NT only)
SystemFunction004 3.51 and higher (NT only)
SystemFunction005 3.51 and higher (NT only)
SystemFunction006 3.51 and higher (NT only)
SystemFunction007 3.51 and higher (NT only)
SystemFunction008 3.51 and higher (NT only)
SystemFunction009 3.51 and higher (NT only)
SystemFunction010 3.51 and higher (NT only)
SystemFunction011 3.51 and higher (NT only)
SystemFunction012 3.51 and higher (NT only)
SystemFunction013 3.51 and higher (NT only)
SystemFunction014 3.51 and higher (NT only)
SystemFunction015 3.51 and higher (NT only)
SystemFunction016 3.51 and higher (NT only)
SystemFunction017 3.51 and higher (NT only)
SystemFunction018 3.51 and higher (NT only)
SystemFunction019 3.51 and higher (NT only)
SystemFunction020 3.51 and higher (NT only)
SystemFunction021 3.51 and higher (NT only)
SystemFunction022 3.51 and higher (NT only)
SystemFunction023 3.51 and higher (NT only)
SystemFunction024 3.51 and higher (NT only)
SystemFunction025 3.51 and higher (NT only)
SystemFunction026 3.51 and higher (NT only)
SystemFunction027 3.51 and higher (NT only)
SystemFunction028 3.51 and higher (NT only)
SystemFunction029 3.51 and higher (NT only)
SystemFunction030 3.51 and higher (NT only)
SystemFunction031 3.51 and higher (NT only)
SystemFunction032 3.51 and higher (NT only)
SystemFunction033 3.51 and higher (NT only)
SystemFunction034 5.0 and higher
SystemFunction035 5.0 and higher
SystemFunction036 5.1 and higher documented
SystemFunction040 5.0 from Windows 2000 SP2, and higher documented
SystemFunction041 5.0 from Windows 2000 SP2, and higher documented
TraceEvent 5.0 and higher documented
TraceEventInstance 5.0 and higher documented
TraceMessage 5.1 and higher documented
TraceMessageVa 5.1 and higher documented
TraceQueryInformation 6.2 and higher
TraceSetInformation 6.1 and higher documented
TreeResetNamedSecurityInfoA 5.1 and higher documented
TreeResetNamedSecurityInfoW 5.1 and higher documented
TreeSetNamedSecurityInfoA 6.0 and higher documented
TreeSetNamedSecurityInfoW 6.0 and higher documented
TrusteeAccessToObjectA 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
TrusteeAccessToObjectW 4.0 from Windows NT 4.0 SP4, and higher (NT);
4.80 and higher (Windows)
UninstallApplication 5.0 and higher documented
UnlockServiceDatabase 3.51 and higher documented
UnregisterIdleTask 5.1 and higher
UnregisterTraceGuids 5.0 and higher documented
UpdateTraceA 5.1 and higher documented
UpdateTraceW 5.1 and higher documented
UsePinForEncryptedFilesA 6.0 and higher
UsePinForEncryptedFilesW 6.0 and higher
WaitServiceState 6.2 and higher
WdmWmiServiceMain 5.1 and 5.2 only
WmiCloseBlock 5.0 and higher
WmiCloseTraceWithCursor 5.1 from Windows XP SP1 to 5.2
WmiConvertTimestamp 5.1 from Windows XP SP1 to 5.2
WmiDevInstToInstanceNameA 5.0 and higher
WmiDevInstToInstanceNameW 5.0 and higher
WmiEnumerateGuids 5.0 and higher
WmiExecuteMethodA 5.0 and higher
WmiExecuteMethodW 5.0 and higher
WmiFileHandleToInstanceNameA 5.0 and higher
WmiFileHandleToInstanceNameW 5.0 and higher
WmiFreeBuffer 5.0 and higher
WmiGetFirstTraceOffset 5.1 and 5.2 only
WmiGetNextEvent 5.1 from Windows XP SP1 to 5.2
WmiGetTraceHeader 5.1 and 5.2 only
WmiMofEnumerateResourcesA 5.0 and higher
WmiMofEnumerateResourcesW 5.0 and higher
WmiNotificationRegistrationA 5.0 and higher
WmiNotificationRegistrationW 5.0 and higher
WmiOpenBlock 5.0 and higher
WmiOpenTraceWithCursor 5.1 from Windows XP SP1 to 5.2
WmiParseTraceEvent 5.1 and 5.2 only
WmiQueryAllDataA 5.0 and higher
WmiQueryAllDataMultipleA 5.1 and higher
WmiQueryAllDataMultipleW 5.1 and higher
WmiQueryAllDataW 5.0 and higher
WmiQueryGuidInformation 5.0 and higher
WmiQuerySingleInstanceA 5.0 and higher
WmiQuerySingleInstanceMultipleA 5.1 and higher
WmiQuerySingleInstanceMultipleW 5.1 and higher
WmiQuerySingleInstanceW 5.0 and higher
WmiReceiveNotificationsA 5.1 and higher
WmiReceiveNotificationsW 5.1 and higher
WmiSetSingleInstanceA 5.0 and higher
WmiSetSingleInstanceW 5.0 and higher
WmiSetSingleItemA 5.0 and higher
WmiSetSingleItemW 5.0 and higher
Wow64Win32ApiEntry 5.1 to 6.0
WriteEncryptedFileRaw 5.0 and higher

C# – Calling into Native DLLs

email me

P/Invoke, short for platform invocation services, allow you to access functions, structs, and callbacks in unmanaged DLLs.

Here, I’m able to import user32.dll, and then use a function inside user32.dll. Pretty cool, huh? Simply by naming a static method with the same name as the extern keyword, MessageBox, in our case, you can access functions within the DLL.

Compiled in Visual Studio 2017.

using System;
using System.Runtime.InteropServices;

class MessageBoxDLL
{
// call to which dll you would like to import
// our unmanaged dll
[DllImport("user32.dll")]

// our function
static extern int MessageBox(IntPtr hWnd, string text, string caption, int type);
// a static method with the same name as the function, i.e. MessageBox
public static void Main()
{
// calls function with relative parameters
// the marshaler does the translation for us
MessageBox(IntPtr.Zero,"This is a test!", "Yo", 0);
}
}

 

Notes

Marshaling Data with Platform Invoke

DllImportAttribute Class

C# – Return FileWriteTime of File

email me

This returns the last write time of a file.

Compiled in Visual Studio 2017.

using System;
using System.IO;

namespace return_timestamp
{
class Touch
{
static void Main(string[] args)
{
string fileName = "c:\\setup\\setup.exe";

FileInfo fileinfo = new FileInfo(fileName);
touchFile(fileinfo);
Console.ReadKey();

}

static void touchFile(FileSystemInfo filename)
{
Console.WriteLine("File name: {0}", filename.FullName);
try
{
filename.CreationTime = filename.LastWriteTime;
Console.Write("\nTimestamp: ");
Console.Write(filename.CreationTime);

}
catch (Exception x)
{
Console.WriteLine("Error: {0}", x.Message);
}
}
}
}

 

Notes

FileInfo Class

FileSystemInfo.LastWriteTime Property

Further research

DateTimeOffset.FromFileTime(Int64) Method