' ########################################################################################
' Microsoft Windows
' File: shlwapi.inc
' Contents: Interface for the Windows light-weight utility APIs
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_Shlwapi_PBI)
#DEFINE PBX_Shlwapi_PBI
%EQUATE `SHLWAPI_INC = 1
#IF NOT %DEF(%NOSHLWAPI)
#INCLUDE ONCE "Legacy/System/ObjBase.inc"
#INCLUDE ONCE "Legacy/System/ShTypes.inc"
'//
'// Users of this header may define any number of these constants to avoid
'// the definitions of each functional group.
'//
'// NO_SHLWAPI_STRFCNS String functions
'// NO_SHLWAPI_PATH Path functions
'// NO_SHLWAPI_REG Registry functions
'// NO_SHLWAPI_STREAM Stream functions
'// NO_SHLWAPI_GDI GDI helper functions
#IF NOT %DEF (%NO_SHLWAPI_STRFCNS)
'//
'//=============== String Routines ===================================
'//
DECLARE FUNCTION StrChrA LIB "shlwapi.dll" ALIAS "StrChrA" ( BYREF lpStart AS ASCIIZ , BYVAL wMatch AS WORD ) AS QUAD
DECLARE FUNCTION StrChrW LIB "shlwapi.dll" ALIAS "StrChrW" ( BYREF lpStart AS WSTRINGZ
 , BYVAL wMatch AS WORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrChr = StrChrW
#ELSE
 MACRO StrChr = StrChrA
#ENDIF
DECLARE FUNCTION StrChrIA LIB "shlwapi.dll" ALIAS "StrChrIA" ( BYREF lpStart AS ASCIIZ , BYVAL wMatch AS WORD ) AS QUAD
DECLARE FUNCTION StrChrIW LIB "shlwapi.dll" ALIAS "StrChrIW" ( BYREF lpStart AS WSTRINGZ
 , BYVAL wMatch AS WORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrChrI = StrChrIW
#ELSE
 MACRO StrChrI = StrChrIA
#ENDIF
DECLARE FUNCTION StrCmpNA LIB "shlwapi.dll" ALIAS "StrCmpNA" ( BYREF lpStr1 AS ASCIIZ , BYREF lpStr2 AS ASCIIZ , BYVAL nChar AS LONG ) AS LONG ' int
DECLARE FUNCTION StrCmpNW LIB "shlwapi.dll" ALIAS "StrCmpNW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr2 AS WSTRINGZ , BYVAL nChar AS LONG ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCmpN = StrCmpNW
#ELSE
 MACRO StrCmpN = StrCmpNA
#ENDIF
DECLARE FUNCTION StrCmpNIA LIB "shlwapi.dll" ALIAS "StrCmpNIA" ( BYREF lpStr1 AS ASCIIZ , BYREF lpStr2 AS ASCIIZ , BYVAL nChar As LONG ) AS LONG ' int
DECLARE FUNCTION StrCmpNIW LIB "shlwapi.dll" ALIAS "StrCmpNIW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr2 AS WSTRINGZ , BYVAL nChar AS LONG ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCmpNI = StrCmpNIW
#ELSE
 MACRO StrCmpNI = StrCmpNIA
#ENDIF
DECLARE FUNCTION StrCSpnA LIB "shlwapi.dll" ALIAS "StrCSpnA" ( BYREF lpStr AS ASCIIZ , BYREF lpSet AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION StrCSpnW LIB "shlwapi.dll" ALIAS "StrCSpnW" ( BYREF lpStr AS WSTRINGZ , BYREF lpSet AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCSpn = StrCSpnW
#ELSE
 MACRO StrCSpn = StrCSpnA
#ENDIF
DECLARE FUNCTION StrCSpnIA LIB "shlwapi.dll" ALIAS "StrCSpnIA" ( BYREF lpStr AS ASCIIZ , BYREF lpSet AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION StrCSpnIW LIB "shlwapi.dll" ALIAS "StrSpnIW" ( BYREF lpStr AS WSTRINGZ , BYREF lpSet AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCSpnI = StrCSpnIW
#ELSE
 MACRO StrCSpnI = StrCSpnIA
#ENDIF
DECLARE FUNCTION StrDupA LIB "shlwapi.dll" ALIAS "StrDupA" ( BYREF lpsz AS ASCIIZ ) AS QUAD
DECLARE FUNCTION StrDupW LIB "shlwapi.dll" ALIAS "StrDupW" ( BYREF lpsz AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrDup = StrDupW
#ELSE
 MACRO StrDup = StrDupA
#ENDIF
'// StrFormatByteSizeEx takes a ULONGLONG as a byte count and formats a string
'// representing that number of bytes in an appropriately concise manner, where
'// "appropriate manner" is determine by several factors:
'//
'// 1) order - is this most appropriately expressed as KB? MB? GB?
'// for example: 1039 -> "1.01 KB", 5454608466 -> "5.08 GB", etc
'//
'// 2) number of whole number places shown - if there are more than a few whole
'// number places to display, decimal places are omitted.
'// for example: 1024 -> "1.00 KB", 12288 -> "12.0 KB", 125952 -> "123 KB"
'//
'// 3) the caller can specify whether the result should involve rounding to the
'// nearest displayed digit, or truncation of undisplayed digits. the caller
'// must specify either rounding or truncation when calling the API.
'// for example: with rounding, 2147483647 -> "2.00 GB"
'// with truncation, 2147483647 -> "1.99 GB"
' enum tagSFBS_FLAGS
%EQUATE `SFBS_FLAGS_ROUND_TO_NEAREST_DISPLAYED_DIGIT = &H0001& ' // round to the nearest displayed digit
%EQUATE `SFBS_FLAGS_TRUNCATE_UNDISPLAYED_DECIMAL_DIGITS = &H0002& ' // discard undisplayed digits
'typedef int SFBS_FLAGS;
DECLARE FUNCTION StrFormatByteSizeEx LIB "shlwapi.dll" ALIAS "StrFormatByteSizeEx" ( BYVAL ull AS QUAD , BYVAL flags AS QUAD , BYREF pszBuf AS WSTRINGZ , BYVAL cchBuf AS QUAD ) AS LONG
DECLARE FUNCTION StrFormatByteSizeA LIB "shlwapi.dll" ALIAS "StrFormatByteSizeA" ( BYVAL dw AS QUAD
 , BYREF pszBuf AS ASCIIZ
 , BYVAL cchBuf AS DWORD
 ) AS DWORD
DECLARE FUNCTION StrFormatByteSizeW LIB "shlwapi.dll" ALIAS "StrFormatByteSizeW" ( BYVAL qdw AS QUAD
 , BYREF pszBuf AS WSTRINGZ
 , BYVAL cchBuf AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrFormatByteSize = StrFormatByteSizeW
#ELSE
 MACRO StrFormatByteSize = StrFormatByteSizeA
#ENDIF
DECLARE FUNCTION StrFormatByteSize64A LIB "shlwapi.dll" ALIAS "StrFormatByteSize64A" ( BYVAL qdw AS QUAD , BYREF pszBuf AS ASCIIZ , BYVAL uiBufSize AS QUAD ) AS QUAD
' StrFormatByteSize64 can be used for either ANSI or Unicode characters. However, while StrFormatByteSize64A
' can be called directly, StrFormatByteSize64W is not defined. When StrFormatByteSize64 is called with a
' Unicode value, StrFormatByteSizeW is used.
#IF %DEF(%UNICODE)
 MACRO StrFormatByteSize64 = StrFormatByteSizeW
#ELSE
 MACRO StrFormatByteSize64 = StrFormatByteSize64A
#ENDIF
DECLARE FUNCTION StrFormatKBSizeA LIB "shlwapi.dll" ALIAS "StrFormatKBSizeA" ( BYVAL qdw AS QUAD , BYREF pszBuf AS ASCIIZ , BYVAL uiBufSize AS QUAD ) AS QUAD
DECLARE FUNCTION StrFormatKBSizeW LIB "shlwapi.dll" ALIAS "StrFormatKBSizeW" ( BYVAL qdw AS QUAD
 , BYREF pszBuf AS WSTRINGZ
 , BYVAL uiBufSize AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrFormatKBSize = StrFormatKBSizeW
#ELSE
 MACRO StrFormatKBSize = StrFormatKBSizeA
#ENDIF
DECLARE FUNCTION StrFromTimeIntervalA LIB "shlwapi.dll" ALIAS "StrFromTimeIntervalA" ( BYREF pszOut AS ASCIIZ , BYVAL cchMax AS QUAD , BYVAL dwTimeMS AS QUAD , BYVAL digits AS LONG ) AS LONG ' int
DECLARE FUNCTION StrFromTimeIntervalW LIB "shlwapi.dll" ALIAS "StrFromTimeIntervalW" ( BYREF pszOut AS WSTRINGZ , BYVAL cchMax AS QUAD , BYVAL dwTimeMS AS QUAD , BYVAL digits AS LONG ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrFromTimeInterval = StrFromTimeIntervalW
#ELSE
 MACRO StrFromTimeInterval = StrFromTimeIntervalA
#ENDIF
DECLARE FUNCTION StrIsIntlEqualA LIB "shlwapi.dll" ALIAS "StrIsIntlEqualA" ( BYVAL fCaseSens AS LONG , BYREF lpString1 AS ASCIIZ , BYREF lpString2 AS ASCIIZ , BYVAL nChar AS LONG ) AS LONG
DECLARE FUNCTION StrIsIntlEqualW LIB "shlwapi.dll" ALIAS "StrIsIntlEqualW" ( BYVAL fCaseSens AS LONG
 , BYREF lpString1 AS WSTRINGZ
 , BYREF lpString2 AS WSTRINGZ
 , BYVAL nChar AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO StrIsIntlEqual = StrIsIntlEqualW
#ELSE
 MACRO StrIsIntlEqual = StrIsIntlEqualA
#ENDIF
DECLARE FUNCTION StrNCatA LIB "shlwapi.dll" ALIAS "StrNCatA" ( BYREF pszFront AS ASCIIZ , BYREF pszBack AS ASCIIZ , BYVAL cchMax AS LONG ) AS QUAD
DECLARE FUNCTION StrNCatW LIB "shlwapi.dll" ALIAS "StrNCatW" ( BYREF pszFront AS WSTRINGZ
 , BYREF pszBack AS WSTRINGZ
 , BYVAL cchMax AS LONG
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrNCat = StrNCatW
#ELSE
 MACRO StrNCat = StrNCatA
#ENDIF
DECLARE FUNCTION StrPBrkA LIB "shlwapi.dll" ALIAS "StrPBrkA" ( BYREF psz AS ASCIIZ , BYREF pszSet AS ASCIIZ ) AS QUAD
DECLARE FUNCTION StrPBrkW LIB "shlwapi.dll" ALIAS "StrPBrkW" ( BYREF psz AS WSTRINGZ
 , BYREF pszSet AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrPBrk = StrPBrkW
#ELSE
 MACRO StrPBrk = StrPBrkA
#ENDIF
DECLARE FUNCTION StrRChrA LIB "shlwapi.dll" ALIAS "StrRChrA" ( BYREF lpStart AS ASCIIZ , BYREF lpEnd AS ASCIIZ , BYVAL wMatch AS BYTE ) AS QUAD
DECLARE FUNCTION StrRChrW LIB "shlwapi.dll" ALIAS "StrRChrW" ( BYREF lpStart AS WSTRINGZ
 , BYREF lpEnd AS WSTRINGZ
 , BYVAL wMatch AS WORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrRChr = StrRChrW
#ELSE
 MACRO StrRChr = StrRChrA
#ENDIF
DECLARE FUNCTION StrRChrIA LIB "shlwapi.dll" ALIAS "StrRChrIA" ( BYREF lpStart AS ASCIIZ , BYREF lpEnd AS ASCIIZ , BYVAL wMatch AS BYTE ) AS QUAD
DECLARE FUNCTION StrRChrIW LIB "shlwapi.dll" ALIAS "StrRChrIW" ( BYREF lpStart AS WSTRINGZ
 , BYREF lpEnd AS WSTRINGZ
 , BYVAL wMatch AS WORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrRChrI = StrRChrIW
#ELSE
 MACRO StrRChrI = StrRChrIA
#ENDIF
DECLARE FUNCTION StrRStrIA LIB "shlwapi.dll" ALIAS "StrRStrIA" ( BYREF pszSource AS ASCIIZ , BYREF pszLast AS ASCIIZ , BYREF pszSrch AS ASCIIZ ) AS QUAD
DECLARE FUNCTION StrRStrIW LIB "shlwapi.dll" ALIAS "StrRStrIW" ( BYREF pszSource AS WSTRINGZ
 , BYREF pszLast AS WSTRINGZ
 , BYREF pszSrch AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrRStrI = StrRStrIW
#ELSE
 MACRO StrRStrI = StrRStrIA
#ENDIF
DECLARE FUNCTION StrSpnA LIB "shlwapi.dll" ALIAS "StrSpnA" ( BYREF psz AS ASCIIZ , BYREF pszSet AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION StrSpnW LIB "shlwapi.dll" ALIAS "StrSpnW" ( BYREF psz AS WSTRINGZ , BYREF pszSet AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrSpn = StrSpnW
#ELSE
 MACRO StrSpn = StrSpnA
#ENDIF
DECLARE FUNCTION StrStrA LIB "shlwapi.dll" ALIAS "StrStrA" ( BYREF lpFirst AS ASCIIZ , BYREF lpSrch AS ASCIIZ ) AS QUAD
DECLARE FUNCTION StrStrW LIB "shlwapi.dll" ALIAS "StrStrW" ( BYREF lpFirst AS WSTRINGZ
 , BYREF lpSrch AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrStr = StrStrW
#ELSE
 MACRO StrStr = StrStrA
#ENDIF
DECLARE FUNCTION StrStrIA LIB "shlwapi.dll" ALIAS "StrStrIA" ( BYREF lpFirst AS ASCIIZ , BYREF lpSrch AS ASCIIZ ) AS QUAD
DECLARE FUNCTION StrStrIW LIB "shlwapi.dll" ALIAS "StrStrIW" ( BYREF lpFirst AS WSTRINGZ
 , BYREF lpSrch AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrStrI = StrStrIW
#ELSE
 MACRO StrStrI = StrStrIA
#ENDIF
DECLARE FUNCTION StrToIntA LIB "shlwapi.dll" ALIAS "StrToIntA" ( BYREF lpSrc AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION StrToIntW LIB "shlwapi.dll" ALIAS "StrToIntW" ( BYREF lpSrc AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrToInt = StrToIntW
#ELSE
 MACRO StrToInt = StrToIntA
#ENDIF
DECLARE FUNCTION StrToIntExA LIB "shlwapi.dll" ALIAS "StrToIntExA" ( BYREF pszString AS ASCIIZ , BYVAL dwFlags AS QUAD , BYREF piRet AS LONG ) AS LONG
DECLARE FUNCTION StrToIntExW LIB "shlwapi.dll" ALIAS "StrToIntExW" ( BYREF pszString AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYREF piRet AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO StrToIntEx = StrToIntExW
#ELSE
 MACRO StrToIntEx = StrToIntExA
#ENDIF
'#if (_WIN32_IE >= _WIN32_IE_IE60)
DECLARE FUNCTION StrToInt64ExA LIB "shlwapi.dll" ALIAS "StrToInt64ExA" ( BYREF pszString AS ASCIIZ , BYVAL dwFlags AS QUAD , BYREF pllRet AS QUAD ) AS LONG
DECLARE FUNCTION StrToInt64ExW LIB "shlwapi.dll" ALIAS "StrToInt64ExW" ( BYREF pszString AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYREF pllRet AS QUAD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO StrToInt64Ex = StrToInt64ExW
#ELSE
 MACRO StrToInt64Ex = StrToInt64ExA
#ENDIF
'#endif // _WIN32_IE_IE60
DECLARE FUNCTION StrTrimA LIB "shlwapi.dll" ALIAS "StrTrimA" ( BYREF pszSource AS ASCIIZ , BYREF pszTrimChars AS ASCIIZ ) AS LONG
DECLARE FUNCTION StrTrimW LIB "shlwapi.dll" ALIAS "StrTrimW" ( BYREF pszSource AS WSTRINGZ
 , BYREF pszTrimChars AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO StrTrim = StrTrimW
#ELSE
 MACRO StrTrim = StrTrimA
#ENDIF
DECLARE FUNCTION StrCatA LIB "kernel32.dll" ALIAS "lstrcatA" ( BYREF psz1 AS ASCIIZ , BYREF psz2 AS ASCIIZ ) AS QUAD
DECLARE FUNCTION StrCatW LIB "shlwapi.dll" ALIAS "StrCatW" ( BYREF psz1 AS WSTRINGZ
 , BYREF psz2 AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrCat = StrCatW
#ELSE
 MACRO StrCat = StrCatA
#ENDIF
DECLARE FUNCTION StrCmpA LIB "kernel32.dll" ALIAS "lstrcmpA" ( BYREF psz1 AS ASCIIZ , BYREF psz2 AS ASCIIZ ) AS QUAD
DECLARE FUNCTION StrCmpW LIB "shlwapi.dll" ALIAS "StrCmpW" ( BYREF lpStr1 AS WSTRINGZ
 , BYREF lpStr2 AS WSTRINGZ
 ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCmp = StrCmpW
#ELSE
 MACRO StrCmp = StrCmpA
#ENDIF
MACRO StrCmpIA = lstrcmpiA
DECLARE FUNCTION StrCmpIW LIB "shlwapi.dll" ALIAS "StrCmpIW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr2 AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCmpI = StrCmpIW
#ELSE
 MACRO StrCmpI = StrCmpIA
#ENDIF
MACRO StrCpyA = lstrcpyA
DECLARE FUNCTION StrCpyW LIB "shlwapi.dll" ALIAS "StrCpyW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr1 AS WSTRINGZ ) AS QUAD
#IF %DEF(%UNICODE)
 MACRO StrCpy = StrCpyW
#ELSE
 MACRO StrCpy = StrCpyA
#ENDIF
MACRO StrCpyNA = lstrcpynA
DECLARE FUNCTION StrCpyNW LIB "shlwapi.dll" ALIAS "StrCpyNW" ( BYREF psz1 AS WSTRINGZ , BYREF psz2 AS WSTRINGZ , BYVAL cchMax AS LONG ) AS QUAD
#IF %DEF(%UNICODE)
 MACRO StrCpyN = StrCpyNW
#ELSE
 MACRO StrCpyN = StrCpyNA
#ENDIF
DECLARE FUNCTION StrCatBuffW LIB "shlwapi.dll" ALIAS "StrCatBuffW" ( BYREF pszDestination AS WSTRINGZ , BYREF pszSource AS WSTRINGZ , BYVAL cchDestBuffSize AS LONG ) AS QUAD
DECLARE FUNCTION StrCatBuffA LIB "shlwapi.dll" ALIAS "StrCatBuffA" ( BYREF pszDestination AS ASCIIZ
 , BYREF pszSource AS ASCIIZ
 , BYVAL cchDestBuffSize AS LONG
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO StrCatBuff = StrCatBuffW
#ELSE
 MACRO StrCatBuff = StrCatBuffA
#ENDIF
DECLARE FUNCTION ChrCmpIA LIB "shlwapi.dll" ALIAS "ChrCmpIA" ( BYVAL w1 AS BYTE , BYVAL w2 AS BYTE ) AS LONG
DECLARE FUNCTION ChrCmpIW LIB "shlwapi.dll" ALIAS "ChrCmpIW" ( BYVAL w1 AS WORD
 , BYVAL w2 AS WORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ChrCmpI = ChrCmpIW
#ELSE
 MACRO ChrCmpI = ChrCmpIA
#ENDIF
DECLARE FUNCTION wvnsprintfA CDECL LIB "shlwapi.dll" ALIAS "wvnsprintfA" ( BYREF lpOut AS ASCIIZ , BYVAL cchLimitIn AS LONG , BYREF pszFmt AS ASCIIZ , BYREF arglist AS ANY ) AS LONG ' int
DECLARE FUNCTION wvnsprintfW CDECL LIB "shlwapi.dll" ALIAS "wvnsprintfW" ( BYREF lpOut AS WSTRINGZ , BYVAL cchLimitIn AS LONG , BYREF pszFmt AS WSTRINGZ , BYREF arglist AS ANY ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO wvnsprintf = wvnsprintfW
#ELSE
 MACRO wvnsprintf = wvnsprintfA
#ENDIF
DECLARE FUNCTION wnsprintfA CDECL LIB "shlwapi.dll" ALIAS "wnsprintfA" ( BYREF lpOut AS ASCIIZ , BYVAL cchLimitIn AS LONG , BYREF pszFmt AS ASCIIZ , OPTIONAL BYREF ANY ' optional parameters , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY ) AS LONG ' int
DECLARE FUNCTION wnsprintfW CDECL LIB "shlwapi.dll" ALIAS "wnsprintfW" ( BYREF lpOut AS WSTRINGZ , BYVAL cchLimitIn AS LONG , BYREF pszFmt AS ASCIIZ , OPTIONAL BYREF ANY ' optional parameters , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY , OPTIONAL BYREF ANY ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO wnsprintf = wnsprintfW
#ELSE
 MACRO wnsprintf = wnsprintfA
#ENDIF
'#define StrIntlEqNA( s1, s2, nChar) StrIsIntlEqualA( TRUE, s1, s2, nChar)
'MACRO StrIntlEqNA(s1, s2, nChar) = StrIsIntlEqualA(%TRUE, s1, s2, nChar)
' // To avoid macro conflicts.
FUNCTION StrIntlEqNA ( BYREF lpString1 AS ASCIIZ
 , BYREF lpString2 AS ASCIIZ
 , BYVAL nChar AS LONG
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "StrIsIntlEqualA")
 IF pProc THEN CALL DWORD pProc USING StrIsIntlEqualA(%TRUE, lpString1, lpString2, nChar) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
'#define StrIntlEqNW( s1, s2, nChar) StrIsIntlEqualW( TRUE, s1, s2, nChar)
'MACRO StrIntlEqNW(s1, s2, nChar) = StrIsIntlEqualW(%TRUE, s1, s2, nChar)
' // To avoid macro conflicts.
FUNCTION StrIntlEqNW ( BYREF lpString1 AS WSTRINGZ
 , BYREF lpString2 AS WSTRINGZ
 , BYVAL nChar AS LONG
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "StrIsIntlEqualW")
 IF pProc THEN CALL DWORD pProc USING StrIsIntlEqualW(%TRUE, lpString1, lpString2, nChar) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
#IF %DEF(%UNICODE)
 MACRO StrIntlEqN = StrIntlEqNW
#ELSE
 MACRO StrIntlEqN = StrIntlEqNA
#ENDIF
'#define StrIntlEqNIA(s1, s2, nChar) StrIsIntlEqualA(FALSE, s1, s2, nChar)
'MACRO StrIntlEqNIA(s1, s2, nChar) = StrIsIntlEqualA(%FALSE, s1, s2, nChar)
' // To avoid macro conflicts.
FUNCTION StrIntlEqNIA ( BYREF lpString1 AS ASCIIZ
 , BYREF lpString2 AS ASCIIZ
 , BYVAL nChar AS LONG
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "StrIsIntlEqualA")
 IF pProc THEN CALL DWORD pProc USING StrIsIntlEqualA(%FALSE, lpString1, lpString2, nChar) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
'#define StrIntlEqNIW(s1, s2, nChar) StrIsIntlEqualW(FALSE, s1, s2, nChar)
'MACRO StrIntlEqNIW(s1, s2, nChar) = StrIsIntlEqualW(%FALSE, s1, s2, nChar)
' // To avoid macro conflicts.
FUNCTION StrIntlEqNIW ( BYREF lpString1 AS WSTRINGZ
 , BYREF lpString2 AS WSTRINGZ
 , BYVAL nChar AS LONG
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "StrIsIntlEqualW")
 IF pProc THEN CALL DWORD pProc USING StrIsIntlEqualW(%FALSE, lpString1, lpString2, nChar) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
#IF %DEF(%UNICODE)
 MACRO StrIntlEqNI = StrIntlEqNIW
#ELSE
 MACRO StrIntlEqNI = StrIntlEqNIA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION StrRetToStrA LIB "ShlWApi.dll" ALIAS "StrRetToStrA" (BYVAL pstr AS STRRET PTR, pidl AS ITEMIDLIST, ppsz AS ANY) AS LONG
#ELSE
DECLARE FUNCTION StrRetToStrA LIB "shlwapi.dll" ALIAS "StrRetToStrA" ( BYREF pstr AS STRRET , BYVAL pidl AS ITEMIDLIST PTR , BYREF ppszName AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION StrRetToStrW LIB "ShlWApi.dll" ALIAS "StrRetToStrW" (BYVAL pstr AS STRRET PTR, pidl AS ITEMIDLIST, ppsz AS ANY) AS LONG
#ELSE
DECLARE FUNCTION StrRetToStrW LIB "shlwapi.dll" ALIAS "StrRetToStrW" ( BYREF pstr AS STRRET , BYVAL pidl AS ITEMIDLIST PTR , BYREF ppszName AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO StrRetToStr = StrRetToStrW
#ELSE
 MACRO StrRetToStr = StrRetToStrA
#ENDIF
DECLARE FUNCTION StrRetToBufA LIB "shlwapi.dll" ALIAS "StrRetToBufA" ( BYREF pstr AS STRRET , BYVAL pidl AS ITEMIDLIST PTR , BYREF pszBuf AS ASCIIZ , BYVAL cchBuf AS QUAD ) AS LONG
DECLARE FUNCTION StrRetToBufW LIB "shlwapi.dll" ALIAS "StrRetToBufW" ( BYREF pstr AS STRRET
 , BYVAL pidl AS ITEMIDLIST PTR
 , BYREF pszBuf AS WSTRINGZ
 , BYVAL cchBuf AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO StrRetToBuf = StrRetToBufW
#ELSE
 MACRO StrRetToBuf = StrRetToBufA
#ENDIF
'// helper to duplicate a string using the task allocator
DECLARE FUNCTION SHStrDupA LIB "shlwapi.dll" ALIAS "SHStrDupA" ( BYREF pszSource AS ASCIIZ , BYREF ppwszTarget AS QUAD ) AS LONG
DECLARE FUNCTION SHStrDupW LIB "shlwapi.dll" ALIAS "SHStrDupW" ( BYREF pszSource AS WSTRINGZ
 , BYREF ppwszTarget AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SHStrDup = SHStrDupW
#ELSE
 MACRO SHStrDup = SHStrDupA
#ENDIF
DECLARE FUNCTION StrCmpLogicalW LIB "shlwapi.dll" ALIAS "StrCmpLogicalW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr2 AS WSTRINGZ ) AS LONG ' int
MACRO StrCmpLogical = StrCmpLogicalW
DECLARE FUNCTION StrCatChainW LIB "shlwapi.dll" ALIAS "StrCatChainW" ( BYREF pszDst AS WSTRINGZ , BYVAL cchDst AS QUAD , BYVAL ichAt AS QUAD , BYREF pszSrc AS WSTRINGZ ) AS QUAD
MACRO StrCatChain = StrCatChainW
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION StrRetToBSTR LIB "ShlWApi.dll" ALIAS "StrRetToBSTR" (BYVAL pstr AS STRRET PTR, pidl AS ITEMIDLIST, pbstr AS ANY) AS LONG
#ELSE
DECLARE FUNCTION StrRetToBSTR LIB "shlwapi.dll" ALIAS "StrRetToBSTR" ( BYREF pstr AS STRRET , BYVAL pidl AS ITEMIDLIST PTR , BYREF pbstr AS WSTRING ) AS LONG
#ENDIF
DECLARE FUNCTION SHLoadIndirectString LIB "shlwapi.dll" ALIAS "SHLoadIndirectString" ( BYREF pszSource AS WSTRINGZ , BYREF pszOutBuf AS WSTRINGZ , BYVAL cchOutBuf AS QUAD , BYREF ppvReserved AS ANY ) AS LONG
'#if (_WIN32_IE >= _WIN32_IE_IE60SP2)
DECLARE FUNCTION IsCharSpaceA LIB "shlwapi.dll" ALIAS "IsCharSpaceA" ( BYVAL wch AS BYTE ) AS LONG
DECLARE FUNCTION IsCharSpaceW LIB "shlwapi.dll" ALIAS "IsCharSpaceW" ( BYVAL wch AS WORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO IsCharSpace = IsCharSpaceW
#ELSE
 MACRO IsCharSpace = IsCharSpaceA
#ENDIF
DECLARE FUNCTION StrCmpCA LIB "shlwapi.dll" ALIAS "StrCmpCA" ( BYREF lpStr1 AS ASCIIZ , BYREF lpStr2 AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION StrCmpCW LIB "shlwapi.dll" ALIAS "StrCmpCW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr2 AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCmpC = StrCmpCW
#ELSE
 MACRO StrCmpC = StrCmpCA
#ENDIF
DECLARE FUNCTION StrCmpICA LIB "shlwapi.dll" ALIAS "StrCmpICA" ( BYREF lpStr1 AS ASCIIZ , BYREF lpStr2 AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION StrCmpICW LIB "shlwapi.dll" ALIAS "StrCmpICW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr2 AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCmpIC = StrCmpICW
#ELSE
 MACRO StrCmpIC = StrCmpICA
#ENDIF
'#endif // _WIN32_IE_IE60SP2
'#if (_WIN32_IE >= _WIN32_IE_IE50)
'// StrCmp*C* - Compare strings using C runtime collation rules.
DECLARE FUNCTION StrCmpNCA LIB "shlwapi.dll" ALIAS "StrCmpNCA" ( BYREF lpStr1 AS ASCIIZ , BYREF lpStr2 AS ASCIIZ , BYVAL nChar AS LONG ) AS LONG ' int
'// StrCmp*C* - Compare strings using C runtime collation rules.
DECLARE FUNCTION StrCmpNCW LIB "shlwapi.dll" ALIAS "StrCmpNCW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr2 AS WSTRINGZ , BYVAL nChar AS LONG ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCmpNC = StrCmpNCW
#ELSE
 MACRO StrCmpNC = StrCmpNCA
#ENDIF
DECLARE FUNCTION StrCmpNICA LIB "shlwapi.dll" ALIAS "StrCmpNICA" ( BYREF lpStr1 AS ASCIIZ , BYREF lpStr2 AS ASCIIZ , BYVAL nChar AS LONG ) AS LONG ' int
DECLARE FUNCTION StrCmpNICW LIB "shlwapi.dll" ALIAS "StrCmpNICW" ( BYREF lpStr1 AS WSTRINGZ , BYREF lpStr2 AS WSTRINGZ , BYVAL nChar AS LONG ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO StrCmpNIC = StrCmpNICW
#ELSE
 MACRO StrCmpNIC = StrCmpNICA
#ENDIF
'#endif // _WIN32_IE_IE50
'// Backward compatible to NT's non-standard naming (strictly
'// for comctl32)
'//
DECLARE FUNCTION IntlStrEqWorkerA LIB "shlwapi.dll" ALIAS "IntlStrEqWorkerA" ( BYVAL fCaseSens AS LONG , BYREF pszStr1 AS ASCIIZ , BYREF pszStr2 AS ASCIIZ , BYVAL nChar AS LONG ) AS LONG
DECLARE FUNCTION IntlStrEqWorkerW LIB "shlwapi.dll" ALIAS "IntlStrEqWorkerW" ( BYVAL fCaseSens AS LONG
 , BYREF pszStr1 AS WSTRINGZ
 , BYREF pszStr2 AS WSTRINGZ
 , BYVAL nChar AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO IntlStrEqWorker = IntlStrEqWorkerW
#ELSE
 MACRO IntlStrEqWorker = IntlStrEqWorkerA
#ENDIF
'#define IntlStrEqNA( s1, s2, nChar) IntlStrEqWorkerA( TRUE, s1, s2, nChar)
'MACRO IntlStrEqNA(s1, s2, nChar) = IntlStrEqWorkerA(%TRUE, s1, s2, nChar)
' // To avoid macro conflicts.
FUNCTION IntlStrEqNA ( BYREF pszStr1 AS ASCIIZ
 , BYREF pszStr2 AS ASCIIZ
 , BYVAL nChar AS LONG
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "IntlStrEqWorkerA")
 IF pProc THEN CALL DWORD pProc USING IntlStrEqWorkerA(%TRUE, pszStr1, pszStr2, nChar) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
'#define IntlStrEqNW( s1, s2, nChar) IntlStrEqWorkerW( TRUE, s1, s2, nChar)
'MACRO IntlStrEqNW(s1, s2, nChar) = IntlStrEqWorkerW(%TRUE, s1, s2, nChar)
' // To avoid macro conflicts.
FUNCTION IntlStrEqNW ( BYREF pszStr1 AS WSTRINGZ
 , BYREF pszStr2 AS WSTRINGZ
 , BYVAL nChar AS LONG
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "IntlStrEqWorkerW")
 IF pProc THEN CALL DWORD pProc USING IntlStrEqWorkerW(%TRUE, pszStr1, pszStr2, nChar) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
'#define IntlStrEqNIA(s1, s2, nChar) IntlStrEqWorkerA(FALSE, s1, s2, nChar)
'MACRO IntlStrEqNIA(s1, s2, nChar) = IntlStrEqWorkerA(%FALSE, s1, s2, nChar)
' // To avoid macro conflicts.
FUNCTION IntlStrEqNIA ( BYREF pszStr1 AS ASCIIZ
 , BYREF pszStr2 AS ASCIIZ
 , BYVAL nChar AS LONG
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "IntlStrEqWorkerA")
 IF pProc THEN CALL DWORD pProc USING IntlStrEqWorkerA(%FALSE, pszStr1, pszStr2, nChar) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
'#define IntlStrEqNIW(s1, s2, nChar) IntlStrEqWorkerW(FALSE, s1, s2, nChar)
'MACRO IntlStrEqNIW(s1, s2, nChar) = IntlStrEqWorkerW(%FALSE, s1, s2, nChar)
' // To avoid macro conflicts.
FUNCTION IntlStrEqNIW ( BYREF pszStr1 AS WSTRINGZ
 , BYREF pszStr2 AS WSTRINGZ
 , BYVAL nChar AS LONG
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "IntlStrEqWorkerW")
 IF pProc THEN CALL DWORD pProc USING IntlStrEqWorkerW(%FALSE, pszStr1, pszStr2, nChar) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
#IF %DEF(%UNICODE)
 MACRO IntlStrEqN = IntlStrEqNW
 MACRO IntlStrEqNI = IntlStrEqNIW
#ELSE
 MACRO IntlStrEqN = IntlStrEqNA
 MACRO IntlStrEqNI = IntlStrEqNIA
#ENDIF
$SZ_CONTENTTYPE_HTMLA = "text/html"
$SZ_CONTENTTYPE_CDFA = "application/x-cdf"
$$SZ_CONTENTTYPE_HTMLW = "text/html"$$
$$SZ_CONTENTTYPE_CDFW = "application/x-cdf"$$
#IF %DEF(%UNICODE)
 MACRO SZ_CONTENTTYPE_HTML = $$SZ_CONTENTTYPE_HTMLW
 MACRO SZ_CONTENTTYPE_CDF = $$SZ_CONTENTTYPE_CDFW
#ELSE
 MACRO SZ_CONTENTTYPE_HTML = $SZ_CONTENTTYPE_HTMLA
 MACRO SZ_CONTENTTYPE_CDF = $SZ_CONTENTTYPE_CDFA
#ENDIF
'#define PathIsHTMLFileA(pszPath) PathIsContentTypeA(pszPath, SZ_CONTENTTYPE_HTMLA)
'MACRO PathIsHTMLFileA(pszPath) = PathIsContentTypeA(pszPath, $SZ_CONTENTTYPE_HTMLA)
' // To avoid macro conflicts.
FUNCTION PathIsHTMLFileA ( BYREF pszPath AS ASCIIZ
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "PathIsContentTypeA")
 IF pProc THEN CALL DWORD pProc USING PathIsContentTypeA(pszPath, $SZ_CONTENTTYPE_HTMLA) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
'#define PathIsHTMLFileW(pszPath) PathIsContentTypeW(pszPath, SZ_CONTENTTYPE_HTMLW)
'MACRO PathIsHTMLFileW(pszPath) = PathIsContentTypeW(pszPath, $$SZ_CONTENTTYPE_HTMLW)
' // To avoid macro conflicts.
FUNCTION PathIsHTMLFileW ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "PathIsContentTypeW")
 IF pProc THEN CALL DWORD pProc USING PathIsContentTypeW(pszPath, $$SZ_CONTENTTYPE_HTMLW) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
#IF %DEF(%UNICODE)
 MACRO PathIsHTMLFile = PathIsHTMLFileW
#ELSE
 MACRO PathIsHTMLFile = PathIsHTMLFileA
#ENDIF
'// Flags for StrToIntEx
%EQUATE `STIF_DEFAULT = &H00000000
%EQUATE `STIF_SUPPORT_HEX = &H00000001
'#define StrCatA lstrcatA
'#define StrCmpA lstrcmpA
'#define StrCmpIA lstrcmpiA
'#define StrCpyA lstrcpyA
'#define StrCpyNA lstrcpynA
'#define StrToLong StrToInt
'#define StrNCmp StrCmpN
'#define StrNCmpI StrCmpNI
'#define StrNCpy StrCpyN
'#define StrCatN StrNCat
MACRO StrToLong = StrToInt
MACRO StrNCmp = StrCmpN
MACRO StrNCmpI = StrCmpNI
MACRO StrNCpy = StrCpyN
MACRO StrCatN = StrNCat
#ENDIF ' // NO_SHLWAPI_STRFCNS
#IF NOT %DEF(%NO_SHLWAPI_PATH)
'//
'//=============== Path Routines ===================================
'//
DECLARE FUNCTION PathAddBackslashA LIB "shlwapi.dll" ALIAS "PathAddBackslashA" ( BYREF lpszPath AS ASCIIZ ) AS QUAD
DECLARE FUNCTION PathAddBackslashW LIB "shlwapi.dll" ALIAS "PathAddBackslashW" ( BYREF lpszPath AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathAddBackslash = PathAddBackslashW
#ELSE
 MACRO PathAddBackslash = PathAddBackslashA
#ENDIF
DECLARE FUNCTION PathAddExtensionA LIB "shlwapi.dll" ALIAS "PathAddExtensionA" ( BYREF pszPath AS ASCIIZ , OPTIONAL BYREF pszExtension AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathAddExtensionW LIB "shlwapi.dll" ALIAS "PathAddExtensionW" ( BYREF pszPath AS WSTRINGZ
 , OPTIONAL BYREF pszExtension AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathAddExtension = PathAddExtensionW
#ELSE
 MACRO PathAddExtension = PathAddExtensionA
#ENDIF
DECLARE FUNCTION PathAppendA LIB "shlwapi.dll" ALIAS "PathAppendA" ( BYREF pszPath AS ASCIIZ , BYREF pszMore AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathAppendW LIB "shlwapi.dll" ALIAS "PathAppendW" ( BYREF pszPath AS WSTRINGZ
 , BYREF pszMore AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathAppend = PathAppendW
#ELSE
 MACRO PathAppend = PathAppendA
#ENDIF
DECLARE FUNCTION PathBuildRootA LIB "shlwapi.dll" ALIAS "PathBuildRootA" ( BYREF szRoot AS ASCIIZ , BYVAL iDrive AS LONG ) AS QUAD
DECLARE FUNCTION PathBuildRootW LIB "shlwapi.dll" ALIAS "PathBuildRootW" ( BYREF szRoot AS WSTRINGZ
 , BYVAL iDrive AS LONG
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathBuildRoot = PathBuildRootW
#ELSE
 MACRO PathBuildRoot = PathBuildRootA
#ENDIF
DECLARE FUNCTION PathCanonicalizeA LIB "shlwapi.dll" ALIAS "PathCanonicalizeA" ( BYREF lpszDst AS ASCIIZ , BYREF lpszSrc AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathCanonicalizeW LIB "shlwapi.dll" ALIAS "PathCanonicalizeW" ( BYREF lpszDst AS WSTRINGZ
 , BYREF lpszSrc AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathCanonicalize = PathCanonicalizeW
#ELSE
 MACRO PathCanonicalize = PathCanonicalizeA
#ENDIF
DECLARE FUNCTION PathCombineA LIB "shlwapi.dll" ALIAS "PathCombineA" ( BYREF lpszDest AS ASCIIZ , BYREF lpszDir AS ASCIIZ , BYREF lpszFile AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathCombineW LIB "shlwapi.dll" ALIAS "PathCombineW" ( BYREF lpszDest AS WSTRINGZ
 , BYREF lpszDir AS WSTRINGZ
 , BYREF lpszFile AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathCombine = PathCombineW
#ELSE
 MACRO PathCombine = PathCombineA
#ENDIF
DECLARE FUNCTION PathCompactPathA LIB "shlwapi.dll" ALIAS "PathCompactPathA" ( BYVAL hDC AS QUAD , BYREF lpszPath AS ASCIIZ , BYVAL dx AS QUAD ) AS LONG
DECLARE FUNCTION PathCompactPathW LIB "shlwapi.dll" ALIAS "PathCompactPathW" ( BYVAL hDC AS QUAD
 , BYREF lpszPath AS WSTRINGZ
 , BYVAL dx AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathCompactPath = PathCompactPathW
#ELSE
 MACRO PathCompactPath = PathCompactPathA
#ENDIF
DECLARE FUNCTION PathCompactPathExA LIB "shlwapi.dll" ALIAS "PathCompactPathExA" ( BYREF pszOut AS ASCIIZ , BYREF pszSrc AS ASCIIZ , BYVAL cchMax AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION PathCompactPathExW LIB "shlwapi.dll" ALIAS "PathCompactPathExW" ( BYREF pszOut AS WSTRINGZ
 , BYREF pszSrc AS WSTRINGZ
 , BYVAL cchMax AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathCompactPathEx = PathCompactPathExW
#ELSE
 MACRO PathCompactPathEx = PathCompactPathExA
#ENDIF
DECLARE FUNCTION PathCommonPrefixA LIB "shlwapi.dll" ALIAS "PathCommonPrefixA" ( BYREF pszFile1 AS ASCIIZ , BYREF pszFile2 AS ASCIIZ , BYREF pszPath AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION PathCommonPrefixW LIB "shlwapi.dll" ALIAS "PathCommonPrefixW" ( BYREF pszFile1 AS WSTRINGZ , BYREF pszFile2 AS WSTRINGZ , BYREF pszPath AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO PathCommonPrefix = PathCommonPrefixW
#ELSE
 MACRO PathCommonPrefix = PathCommonPrefixA
#ENDIF
DECLARE FUNCTION PathFileExistsA LIB "shlwapi.dll" ALIAS "PathFileExistsA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathFileExistsW LIB "shlwapi.dll" ALIAS "PathFileExistsW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathFileExists = PathFileExistsW
#ELSE
 MACRO PathFileExists = PathFileExistsA
#ENDIF
DECLARE FUNCTION PathFindExtensionA LIB "shlwapi.dll" ALIAS "PathFindExtensionA" ( BYREF pPath AS ASCIIZ ) AS QUAD
DECLARE FUNCTION PathFindExtensionW LIB "shlwapi.dll" ALIAS "PathFindExtensionW" ( BYREF pPath AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathFindExtension = PathFindExtensionW
#ELSE
 MACRO PathFindExtension = PathFindExtensionA
#ENDIF
DECLARE FUNCTION PathFindFileNameA LIB "shlwapi.dll" ALIAS "PathFindFileNameA" ( BYREF pPath AS ASCIIZ ) AS QUAD
DECLARE FUNCTION PathFindFileNameW LIB "shlwapi.dll" ALIAS "PathFindFileNameW" ( BYREF pPath AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathFindFileName = PathFindFileNameW
#ELSE
 MACRO PathFindFileName = PathFindFileNameA
#ENDIF
DECLARE FUNCTION PathFindNextComponentA LIB "shlwapi.dll" ALIAS "PathFindNextComponentA" ( BYREF pszPath AS ASCIIZ ) AS QUAD
DECLARE FUNCTION PathFindNextComponentW LIB "shlwapi.dll" ALIAS "PathFindNextComponentW" ( BYREF pszPath AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathFindNextComponent = PathFindNextComponentW
#ELSE
 MACRO PathFindNextComponent = PathFindNextComponentA
#ENDIF
DECLARE FUNCTION PathFindOnPathA LIB "shlwapi.dll" ALIAS "PathFindOnPathA" ( BYREF pszFile AS ASCIIZ , BYREF ppszOtherDirs AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathFindOnPathW LIB "shlwapi.dll" ALIAS "PathFindOnPathW" ( BYREF pszFile AS WSTRINGZ
 , BYREF ppszOtherDirs AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathFindOnPath = PathFindOnPathW
#ELSE
 MACRO PathFindOnPath = PathFindOnPathA
#ENDIF
DECLARE FUNCTION PathFindSuffixArrayA LIB "shlwapi.dll" ALIAS "PathFindSuffixArrayA" ( BYREF pszPath AS ASCIIZ , BYREF apszSuffix AS ASCIIZ , BYVAL iArraySize AS LONG ) AS QUAD
DECLARE FUNCTION PathFindSuffixArrayW LIB "shlwapi.dll" ALIAS "PathFindSuffixArrayW" ( BYREF pszPath AS WSTRINGZ
 , BYREF apszSuffix AS WSTRINGZ
 , BYVAL iArraySize AS LONG
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathFindSuffixArray = PathFindSuffixArrayW
#ELSE
 MACRO PathFindSuffixArray = PathFindSuffixArrayA
#ENDIF
DECLARE FUNCTION PathGetArgsA LIB "shlwapi.dll" ALIAS "PathGetArgsA" ( BYREF pszPath AS ASCIIZ ) AS QUAD
DECLARE FUNCTION PathGetArgsW LIB "shlwapi.dll" ALIAS "PathGetArgsW" ( BYREF pszPath AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathGetArgs = PathGetArgsW
#ELSE
 MACRO PathGetArgs = PathGetArgsA
#ENDIF
DECLARE FUNCTION PathIsLFNFileSpecA LIB "shlwapi.dll" ALIAS "PathIsLFNFileSpecA" ( BYREF pszName AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsLFNFileSpecW LIB "shlwapi.dll" ALIAS "PathIsLFNFileSpecW" ( BYREF pszName AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsLFNFileSpec = PathIsLFNFileSpecW
#ELSE
 MACRO PathIsLFNFileSpec = PathIsLFNFileSpecA
#ENDIF
DECLARE FUNCTION PathGetCharTypeA LIB "shlwapi.dll" ALIAS "PathGetCharTypeA" ( BYVAL ch AS BYTE ) AS QUAD ' UINT
DECLARE FUNCTION PathGetCharTypeW LIB "shlwapi.dll" ALIAS "PathGetCharTypeW" ( BYVAL ch AS WORD ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO PathGetCharType = PathGetCharTypeW
#ELSE
 MACRO PathGetCharType = PathGetCharTypeA
#ENDIF
'// Return flags for PathGetCharType
%EQUATE `GCT_INVALID = &H0000
%EQUATE `GCT_LFNCHAR = &H0001
%EQUATE `GCT_SHORTCHAR = &H0002
%EQUATE `GCT_WILD = &H0004
%EQUATE `GCT_SEPARATOR = &H0008
DECLARE FUNCTION PathGetDriveNumberA LIB "shlwapi.dll" ALIAS "PathGetDriveNumberA" ( BYREF lpsz AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION PathGetDriveNumberW LIB "shlwapi.dll" ALIAS "PathGetDriveNumberW" ( BYREF lpsz AS WSTRINGZ ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO PathGetDriveNumber = PathGetDriveNumberW
#ELSE
 MACRO PathGetDriveNumber = PathGetDriveNumberA
#ENDIF
DECLARE FUNCTION PathIsDirectoryA LIB "shlwapi.dll" ALIAS "PathIsDirectoryA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsDirectoryW LIB "shlwapi.dll" ALIAS "PathIsDirectoryW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsDirectory = PathIsDirectoryW
#ELSE
 MACRO PathIsDirectory = PathIsDirectoryA
#ENDIF
DECLARE FUNCTION PathIsDirectoryEmptyA LIB "shlwapi.dll" ALIAS "PathIsDirectoryEmptyA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsDirectoryEmptyW LIB "shlwapi.dll" ALIAS "PathIsDirectoryEmptyW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsDirectoryEmpty = PathIsDirectoryEmptyW
#ELSE
 MACRO PathIsDirectoryEmpty = PathIsDirectoryEmptyA
#ENDIF
DECLARE FUNCTION PathIsFileSpecA LIB "shlwapi.dll" ALIAS "PathIsFileSpecA" ( BYREF lpszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsFileSpecW LIB "shlwapi.dll" ALIAS "PathIsFileSpecW" ( BYREF lpszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsFileSpec = PathIsFileSpecW
#ELSE
 MACRO PathIsFileSpec = PathIsFileSpecA
#ENDIF
DECLARE FUNCTION PathIsPrefixA LIB "shlwapi.dll" ALIAS "PathIsPrefixA" ( BYREF pszPrefix AS ASCIIZ , BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsPrefixW LIB "shlwapi.dll" ALIAS "PathIsPrefixW" ( BYREF pszPrefix AS WSTRINGZ
 , BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsPrefix = PathIsPrefixW
#ELSE
 MACRO PathIsPrefix = PathIsPrefixA
#ENDIF
DECLARE FUNCTION PathIsRelativeA LIB "shlwapi.dll" ALIAS "PathIsRelativeA" ( BYREF lpszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsRelativeW LIB "shlwapi.dll" ALIAS "PathIsRelativeW" ( BYREF lpszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsRelative = PathIsRelativeW
#ELSE
 MACRO PathIsRelative = PathIsRelativeA
#ENDIF
DECLARE FUNCTION PathIsRootA LIB "shlwapi.dll" ALIAS "PathIsRootA" ( BYREF pPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsRootW LIB "shlwapi.dll" ALIAS "PathIsRootW" ( BYREF pPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsRoot = PathIsRootW
#ELSE
 MACRO PathIsRoot = PathIsRootA
#ENDIF
DECLARE FUNCTION PathIsSameRootA LIB "shlwapi.dll" ALIAS "PathIsSameRootA" ( BYREF pszPath1 AS ASCIIZ , BYREF pszPath2 AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsSameRootW LIB "shlwapi.dll" ALIAS "PathIsSameRootW" ( BYREF pszPath1 AS WSTRINGZ
 , BYREF pszPath2 AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsSameRoot = PathIsSameRootW
#ELSE
 MACRO PathIsSameRoot = PathIsSameRootA
#ENDIF
DECLARE FUNCTION PathIsUNCA LIB "shlwapi.dll" ALIAS "PathIsUNCA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsUNCW LIB "shlwapi.dll" ALIAS "PathIsUNCW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsUNC = PathIsUNCW
#ELSE
 MACRO PathIsUNC = PathIsUNCA
#ENDIF
DECLARE FUNCTION PathIsNetworkPathA LIB "shlwapi.dll" ALIAS "PathIsNetworkPathA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsNetworkPathW LIB "shlwapi.dll" ALIAS "PathIsNetworkPathW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsNetworkPath = PathIsNetworkPathW
#ELSE
 MACRO PathIsNetworkPath = PathIsNetworkPathA
#ENDIF
DECLARE FUNCTION PathIsUNCServerA LIB "shlwapi.dll" ALIAS "PathIsUNCServerA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsUNCServerW LIB "shlwapi.dll" ALIAS "PathIsUNCServerW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsUNCServer = PathIsUNCServerW
#ELSE
 MACRO PathIsUNCServer = PathIsUNCServerA
#ENDIF
DECLARE FUNCTION PathIsUNCServerShareA LIB "shlwapi.dll" ALIAS "PathIsUNCServerShareA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsUNCServerShareW LIB "shlwapi.dll" ALIAS "PathIsUNCServerShareW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsUNCServerShare = PathIsUNCServerShareW
#ELSE
 MACRO PathIsUNCServerShare = PathIsUNCServerShareA
#ENDIF
DECLARE FUNCTION PathIsContentTypeA LIB "shlwapi.dll" ALIAS "PathIsContentTypeA" ( BYREF pszPath AS ASCIIZ , BYREF pszContentType AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsContentTypeW LIB "shlwapi.dll" ALIAS "PathIsContentTypeW" ( BYREF pszPath AS WSTRINGZ
 , BYREF pszContentType AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsContentType = PathIsContentTypeW
#ELSE
 MACRO PathIsContentType = PathIsContentTypeA
#ENDIF
DECLARE FUNCTION PathIsURLA LIB "shlwapi.dll" ALIAS "PathIsURLA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathIsURLW LIB "shlwapi.dll" ALIAS "PathIsURLW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsURL = PathIsURLW
#ELSE
 MACRO PathIsURL = PathIsURLA
#ENDIF
DECLARE FUNCTION PathMakePrettyA LIB "shlwapi.dll" ALIAS "PathMakePrettyA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathMakePrettyW LIB "shlwapi.dll" ALIAS "PathMakePrettyW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathMakePretty = PathMakePrettyW
#ELSE
 MACRO PathMakePretty = PathMakePrettyA
#ENDIF
DECLARE FUNCTION PathMatchSpecA LIB "shlwapi.dll" ALIAS "PathMatchSpecA" ( BYREF pszFileParam AS ASCIIZ , BYREF pszSpec AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathMatchSpecW LIB "shlwapi.dll" ALIAS "PathMatchSpecW" ( BYREF pszFileParam AS WSTRINGZ
 , BYREF pszSpec AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathMatchSpec = PathMatchSpecW
#ELSE
 MACRO PathMatchSpec = PathMatchSpecA
#ENDIF
'#if (_WIN32_IE >= _WIN32_IE_IE70)
'// Flags for PathMatchSpecEx
%EQUATE `PMSF_NORMAL = &H00000000
%EQUATE `PMSF_MULTIPLE = &H00000001
%EQUATE `PMSF_DONT_STRIP_SPACES = &H00010000 ' // modifies either of the above
DECLARE FUNCTION PathMatchSpecExA LIB "shlwapi.dll" ALIAS "PathMatchSpecExA" ( BYREF pszFile AS ASCIIZ , BYREF pszSpec AS ASCIIZ , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION PathMatchSpecExW LIB "shlwapi.dll" ALIAS "PathMatchSpecExW" ( BYREF pszFile AS WSTRINGZ
 , BYREF pszSpec AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathMatchSpecEx = PathMatchSpecExW
#ELSE
 MACRO PathMatchSpecEx = PathMatchSpecExA
#ENDIF
'#endif // _WIN32_IE_IE70
DECLARE FUNCTION PathParseIconLocationA LIB "shlwapi.dll" ALIAS "PathParseIconLocationA" ( BYREF pszIconFile AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathParseIconLocationW LIB "shlwapi.dll" ALIAS "PathParseIconLocationW" ( BYREF pszIconFile AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathParseIconLocation = PathParseIconLocationW
#ELSE
 MACRO PathParseIconLocation = PathParseIconLocationA
#ENDIF
DECLARE SUB PathQuoteSpacesA LIB "shlwapi.dll" ALIAS "PathQuoteSpacesA" ( BYREF lpsz AS ASCIIZ ) ' void
DECLARE SUB PathQuoteSpacesW LIB "shlwapi.dll" ALIAS "PathQuoteSpacesW" ( BYREF lpsz AS WSTRINGZ ) ' void
#IF %DEF(%UNICODE)
 MACRO PathQuoteSpaces = PathQuoteSpacesW
#ELSE
 MACRO PathQuoteSpaces = PathQuoteSpacesA
#ENDIF
DECLARE FUNCTION PathRelativePathToA LIB "shlwapi.dll" ALIAS "PathRelativePathToA" ( BYREF pszPath AS ASCIIZ , BYREF pszFrom AS ASCIIZ , BYVAL dwAttrFrom AS QUAD , BYREF pszTo AS ASCIIZ , BYVAL dwAttrTo AS QUAD ) AS LONG
DECLARE FUNCTION PathRelativePathToW LIB "shlwapi.dll" ALIAS "PathRelativePathToW" ( BYREF pszPath AS WSTRINGZ
 , BYREF pszFrom AS WSTRINGZ
 , BYVAL dwAttrFrom AS DWORD
 , BYREF pszTo AS WSTRINGZ
 , BYVAL dwAttrTo AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathRelativePathTo = PathRelativePathToW
#ELSE
 MACRO PathRelativePathTo = PathRelativePathToA
#ENDIF
DECLARE SUB PathRemoveArgsA LIB "shlwapi.dll" ALIAS "PathRemoveArgsA" ( BYREF pszPath AS ASCIIZ ) ' void
DECLARE SUB PathRemoveArgsW LIB "shlwapi.dll" ALIAS "PathRemoveArgsW" ( BYREF pszPath AS WSTRINGZ ) ' void
#IF %DEF(%UNICODE)
 MACRO PathRemoveArgs = PathRemoveArgsW
#ELSE
 MACRO PathRemoveArgs = PathRemoveArgsA
#ENDIF
DECLARE FUNCTION PathRemoveBackslashA LIB "shlwapi.dll" ALIAS "PathRemoveBackslashA" ( BYREF pszPath AS ASCIIZ ) AS QUAD
DECLARE FUNCTION PathRemoveBackslashW LIB "shlwapi.dll" ALIAS "PathRemoveBackslashW" ( BYREF pszPath AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathRemoveBackslash = PathRemoveBackslashW
#ELSE
 MACRO PathRemoveBackslash = PathRemoveBackslashA
#ENDIF
DECLARE SUB PathRemoveBlanksA LIB "shlwapi.dll" ALIAS "PathRemoveBlanksA" ( BYREF lpszString AS ASCIIZ ) ' void
DECLARE SUB PathRemoveBlanksW LIB "shlwapi.dll" ALIAS "PathRemoveBlanksW" ( BYREF lpszString AS WSTRINGZ ) ' void
#IF %DEF(%UNICODE)
 MACRO PathRemoveBlanks = PathRemoveBlanksW
#ELSE
 MACRO PathRemoveBlanks = PathRemoveBlanksA
#ENDIF
DECLARE SUB PathRemoveExtensionA LIB "shlwapi.dll" ALIAS "PathRemoveExtensionA" ( BYREF pszPath AS ASCIIZ ) ' void
DECLARE SUB PathRemoveExtensionW LIB "shlwapi.dll" ALIAS "PathRemoveExtensionW" ( BYREF pszPath AS WSTRINGZ ) ' void
#IF %DEF(%UNICODE)
 MACRO PathRemoveExtension = PathRemoveExtensionW
#ELSE
 MACRO PathRemoveExtension = PathRemoveExtensionA
#ENDIF
DECLARE FUNCTION PathRemoveFileSpecA LIB "shlwapi.dll" ALIAS "PathRemoveFileSpecA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathRemoveFileSpecW LIB "shlwapi.dll" ALIAS "PathRemoveFileSpecW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathRemoveFileSpec = PathRemoveFileSpecW
#ELSE
 MACRO PathRemoveFileSpec = PathRemoveFileSpecA
#ENDIF
DECLARE FUNCTION PathRenameExtensionA LIB "shlwapi.dll" ALIAS "PathRenameExtensionA" ( BYREF pszPath AS ASCIIZ , BYREF pszExt AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathRenameExtensionW LIB "shlwapi.dll" ALIAS "PathRenameExtensionW" ( BYREF pszPath AS WSTRINGZ
 , BYREF pszExt AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathRenameExtension = PathRenameExtensionW
#ELSE
 MACRO PathRenameExtension = PathRenameExtensionA
#ENDIF
DECLARE FUNCTION PathSearchAndQualifyA LIB "shlwapi.dll" ALIAS "PathSearchAndQualifyA" ( BYREF pcszPath AS ASCIIZ , BYREF pszFullyQualifiedPath AS ASCIIZ , BYVAL cchFullyQualifyedPath AS QUAD ) AS LONG
DECLARE FUNCTION PathSearchAndQualifyW LIB "shlwapi.dll" ALIAS "PathSearchAndQualifyW" ( BYREF pcszPath AS WSTRINGZ
 , BYREF pszFullyQualifiedPath AS WSTRINGZ
 , BYVAL cchFullyQualifyedPath AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathSearchAndQualify = PathSearchAndQualifyW
#ELSE
 MACRO PathSearchAndQualify = PathSearchAndQualifyA
#ENDIF
DECLARE SUB PathSetDlgItemPathA LIB "shlwapi.dll" ALIAS "PathSetDlgItemPathA" ( BYVAL hDlg AS QUAD , BYVAL id AS LONG , BYREF pszPath AS ASCIIZ ) ' void
DECLARE SUB PathSetDlgItemPathW LIB "shlwapi.dll" ALIAS "PathSetDlgItemPath" ( BYVAL hDlg AS QUAD , BYVAL id AS LONG , BYREF pszPath AS WSTRINGZ ) ' void
#IF %DEF(%UNICODE)
 MACRO PathSetDlgItemPath = PathSetDlgItemPathW
#ELSE
 MACRO PathSetDlgItemPath = PathSetDlgItemPathA
#ENDIF
DECLARE FUNCTION PathSkipRootA LIB "shlwapi.dll" ALIAS "PathSkipRootA" ( BYREF pszPath AS ASCIIZ ) AS QUAD
DECLARE FUNCTION PathSkipRootW LIB "shlwapi.dll" ALIAS "PathSkipRootW" ( BYREF pszPath AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO PathSkipRoot = PathSkipRootW
#ELSE
 MACRO PathSkipRoot = PathSkipRootA
#ENDIF
DECLARE SUB PathStripPathA LIB "shlwapi.dll" ALIAS "PathStripPathA" ( BYREF pszPath AS ASCIIZ ) ' void
DECLARE SUB PathStripPathW LIB "shlwapi.dll" ALIAS "PathStripPathW" ( BYREF pszPath AS WSTRINGZ ) ' void
#IF %DEF(%UNICODE)
 MACRO PathStripPath = PathStripPathW
#ELSE
 MACRO PathStripPath = PathStripPathA
#ENDIF
DECLARE FUNCTION PathStripToRootA LIB "shlwapi.dll" ALIAS "PathStripToRootA" ( BYREF szRoot AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathStripToRootW LIB "shlwapi.dll" ALIAS "PathStripToRootW" ( BYREF szRoot AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathStripToRoot = PathStripToRootW
#ELSE
 MACRO PathStripToRoot = PathStripToRootA
#ENDIF
DECLARE SUB PathUnquoteSpacesA LIB "shlwapi.dll" ALIAS "PathUnquoteSpacesA" ( BYREF lpsz AS ASCIIZ ) ' void
DECLARE SUB PathUnquoteSpacesW LIB "shlwapi.dll" ALIAS "PathUnquoteSpacesW" ( BYREF lpsz AS WSTRINGZ ) ' void
#IF %DEF(%UNICODE)
 MACRO PathUnquoteSpaces = PathUnquoteSpacesW
#ELSE
 MACRO PathUnquoteSpaces = PathUnquoteSpacesA
#ENDIF
DECLARE FUNCTION PathMakeSystemFolderA LIB "shlwapi.dll" ALIAS "PathMakeSystemFolderA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathMakeSystemFolderW LIB "shlwapi.dll" ALIAS "PathMakeSystemFolderW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathMakeSystemFolder = PathMakeSystemFolderW
#ELSE
 MACRO PathMakeSystemFolder = PathMakeSystemFolderA
#ENDIF
DECLARE FUNCTION PathUnmakeSystemFolderA LIB "shlwapi.dll" ALIAS "PathUnmakeSystemFolderA" ( BYREF pszPath AS ASCIIZ ) AS LONG
DECLARE FUNCTION PathUnmakeSystemFolderW LIB "shlwapi.dll" ALIAS "PathUnmakeSystemFolderW" ( BYREF pszPath AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathUnmakeSystemFolder = PathUnmakeSystemFolderW
#ELSE
 MACRO PathUnmakeSystemFolder = PathUnmakeSystemFolderA
#ENDIF
DECLARE FUNCTION PathIsSystemFolderA LIB "shlwapi.dll" ALIAS "PathIsSystemFolderA" ( BYREF pszPath AS ASCIIZ , BYVAL dwAttrb AS QUAD ) AS LONG
DECLARE FUNCTION PathIsSystemFolderW LIB "shlwapi.dll" ALIAS "PathIsSystemFolderW" ( BYREF pszPath AS WSTRINGZ
 , BYVAL dwAttrb AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathIsSystemFolder = PathIsSystemFolderW
#ELSE
 MACRO PathIsSystemFolder = PathIsSystemFolderA
#ENDIF
DECLARE SUB PathUndecorateA LIB "shlwapi.dll" ALIAS "PathUndecorateA" ( BYREF pszPath AS ASCIIZ ) ' void
DECLARE SUB PathundecorateW LIB "shlwapi.dll" ALIAS "PathUndecorateW" ( BYREF pszPath AS WSTRINGZ ) ' void
#IF %DEF(%UNICODE)
 MACRO PathUndecorate = PathundecorateW
#ELSE
 MACRO PathUndecorate = PathundecorateA
#ENDIF
DECLARE FUNCTION PathUnExpandEnvStringsA LIB "shlwapi.dll" ALIAS "PathUnExpandEnvStringsA" ( BYREF pszPath AS ASCIIZ , BYREF pszBuf AS ASCIIZ , BYVAL cchBuf AS QUAD ) AS LONG
DECLARE FUNCTION PathUnExpandEnvStringsW LIB "shlwapi.dll" ALIAS "PathUnExpandEnvStringsW" ( BYREF pszPath AS WSTRINGZ
 , BYREF pszBuf AS WSTRINGZ
 , BYVAL cchBuf AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathUnExpandEnvStrings = PathUnExpandEnvStringsW
#ELSE
 MACRO PathUnExpandEnvStrings = PathUnExpandEnvStringsA
#ENDIF
' URL_SCHEME enum
%EQUATE `URL_SCHEME_INVALID = -1
%EQUATE `URL_SCHEME_UNKNOWN = 0
%EQUATE `URL_SCHEME_FTP = 1
%EQUATE `URL_SCHEME_HTTP = 2
%EQUATE `URL_SCHEME_GOPHER = 3
%EQUATE `URL_SCHEME_MAILTO = 4
%EQUATE `URL_SCHEME_NEWS = 5
%EQUATE `URL_SCHEME_NNTP = 6
%EQUATE `URL_SCHEME_TELNET = 7
%EQUATE `URL_SCHEME_WAIS = 8
%EQUATE `URL_SCHEME_FILE = 9
%EQUATE `URL_SCHEME_MK = 10
%EQUATE `URL_SCHEME_HTTPS = 11
%EQUATE `URL_SCHEME_SHELL = 12
%EQUATE `URL_SCHEME_SNEWS = 13
%EQUATE `URL_SCHEME_LOCAL = 14
%EQUATE `URL_SCHEME_JAVASCRIPT = 15
%EQUATE `URL_SCHEME_VBSCRIPT = 16
%EQUATE `URL_SCHEME_ABOUT = 17
%EQUATE `URL_SCHEME_RES = 18
'#if (_WIN32_IE >= _WIN32_IE_IE60)
%EQUATE `URL_SCHEME_MSSHELLROOTED = 19
%EQUATE `URL_SCHEME_MSSHELLIDLIST = 20
%EQUATE `URL_SCHEME_MSHELP = 21
'#endif // _WIN32_IE_IE60
'#if (_WIN32_IE >= _WIN32_IE_IE70)
%EQUATE `URL_SCHEME_MSSHELLDEVICE = 22
%EQUATE `URL_SCHEME_WILDCARD = 23
'#endif // _WIN32_IE_IE70
%EQUATE `URL_SCHEME_SEARCH_MS = 24
'#if (NTDDI_VERSION >= NTDDI_VISTASP1)
%EQUATE `URL_SCHEME_SEARCH = 25
'#endif
'#if (NTDDI_VERSION >= NTDDI_WIN7)
%EQUATE `URL_SCHEME_KNOWNFOLDER = 26
'#endif
%EQUATE `URL_SCHEME_MAXVALUE = 27
' URL_PART enum
%EQUATE `URL_PART_NONE = 0
%EQUATE `URL_PART_SCHEME = 1
%EQUATE `URL_PART_HOSTNAME = 2
%EQUATE `URL_PART_USERNAME = 3
%EQUATE `URL_PART_PASSWORD = 4
%EQUATE `URL_PART_PORT = 5
%EQUATE `URL_PART_QUERY = 6
' URLIS enum
%EQUATE `URLIS_URL = 0
%EQUATE `URLIS_OPAQUE = 1
%EQUATE `URLIS_NOHISTORY = 2
%EQUATE `URLIS_FILEURL = 3
%EQUATE `URLIS_APPLIABLE = 4
%EQUATE `URLIS_DIRECTORY = 5
%EQUATE `URLIS_HASQUERY = 6
%EQUATE `URL_UNESCAPE = &H10000000
%EQUATE `URL_ESCAPE_UNSAFE = &H20000000
%EQUATE `URL_PLUGGABLE_PROTOCOL = &H40000000
%EQUATE `URL_WININET_COMPATIBILITY = &H80000000
%EQUATE `URL_DONT_ESCAPE_EXTRA_INFO = &H02000000
%EQUATE `URL_DONT_UNESCAPE_EXTRA_INFO = %URL_DONT_ESCAPE_EXTRA_INFO
%EQUATE `URL_BROWSER_MODE = %URL_DONT_ESCAPE_EXTRA_INFO
%EQUATE `URL_ESCAPE_SPACES_ONLY = &H04000000
%EQUATE `URL_DONT_SIMPLIFY = &H08000000
%EQUATE `URL_NO_META = %URL_DONT_SIMPLIFY
%EQUATE `URL_UNESCAPE_INPLACE = &H00100000
%EQUATE `URL_CONVERT_IF_DOSPATH = &H00200000
%EQUATE `URL_UNESCAPE_HIGH_ANSI_ONLY = &H00400000
%EQUATE `URL_INTERNAL_PATH = &H00800000 ' / Will escape #'s in paths
%EQUATE `URL_FILE_USE_PATHURL = &H00010000
'#if (_WIN32_IE >= _WIN32_IE_IE60SP2)
%EQUATE `URL_DONT_UNESCAPE = &H00020000 ' / Do not unescape the path/url at all
'#endif // _WIN32_IE_IE60SP2
'#if (NTDDI_VERSION >= NTDDI_WIN7)
%EQUATE `URL_ESCAPE_AS_UTF8 = &H00040000 ' // Percent-encode all non-ASCII characters as their UTF-8 equivalents.
'#endif // (NTDDI_VERSION >= NTDDI_WIN7)
%EQUATE `URL_ESCAPE_PERCENT = &H00001000
%EQUATE `URL_ESCAPE_SEGMENT_ONLY = &H00002000 ' / Treat the entire URL param as one URL segment.
%EQUATE `URL_PARTFLAG_KEEPSCHEME = &H00000001
%EQUATE `URL_APPLY_DEFAULT = &H00000001
%EQUATE `URL_APPLY_GUESSSCHEME = &H00000002
%EQUATE `URL_APPLY_GUESSFILE = &H00000004
%EQUATE `URL_APPLY_FORCEAPPLY = &H00000008
DECLARE FUNCTION UrlCompareA LIB "shlwapi.dll" ALIAS "UrlCompareA" ( BYREF pszURL1 AS ASCIIZ , BYREF pszURL2 AS ASCIIZ , BYVAL fIgnoreSlash AS QUAD ) AS LONG ' int
DECLARE FUNCTION UrlCompareW LIB "shlwapi.dll" ALIAS "UrlCompareW" ( BYREF pszURL1 AS WSTRINGZ , BYREF pszURL2 AS WSTRINGZ , BYVAL fIgnoreSlash AS QUAD ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO UrlCompare = UrlCompareW
#ELSE
 MACRO UrlCompare = UrlCompareA
#ENDIF
DECLARE FUNCTION UrlCombineA LIB "shlwapi.dll" ALIAS "UrlCombineA" ( BYREF pszBase AS ASCIIZ , BYREF pszRelative AS ASCIIZ , BYREF pszCombined AS ASCIIZ , BYREF pcchCombined AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION UrlCombineW LIB "shlwapi.dll" ALIAS "UrlCombineW" ( BYREF pszBase AS WSTRINGZ
 , BYREF pszRelative AS WSTRINGZ
 , BYREF pszCombined AS WSTRINGZ
 , BYREF pcchCombined AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlCombine = UrlCombineW
#ELSE
 MACRO UrlCombine = UrlCombineA
#ENDIF
DECLARE FUNCTION UrlCanonicalizeA LIB "shlwapi.dll" ALIAS "UrlCanonicalizeA" ( BYREF pszUrl AS ASCIIZ , BYREF pszCanonicalized AS ASCIIZ , BYREF pcchCanonicalized AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION UrlCanonicalizeW LIB "shlwapi.dll" ALIAS "UrlCanonicalizeW" ( BYREF pszUrl AS WSTRINGZ
 , BYREF pszCanonicalized AS WSTRINGZ
 , BYREF pcchCanonicalized AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlCanonicalize = UrlCanonicalizeW
#ELSE
 MACRO UrlCanonicalize = UrlCanonicalizeA
#ENDIF
DECLARE FUNCTION UrlIsOpaqueA LIB "shlwapi.dll" ALIAS "UrlIsOpaqueA" ( BYREF pszURL AS ASCIIZ ) AS LONG
DECLARE FUNCTION UrlIsOpaqueW LIB "shlwapi.dll" ALIAS "UrlIsOpaqueW" ( BYREF pszURL AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlIsOpaque = UrlIsOpaqueW
#ELSE
 MACRO UrlIsOpaque = UrlIsOpaqueA
#ENDIF
DECLARE FUNCTION UrlIsNoHistoryA LIB "shlwapi.dll" ALIAS "UrlIsNoHistoryA" ( BYREF pszURL AS ASCIIZ ) AS LONG
DECLARE FUNCTION UrlIsNoHistoryW LIB "shlwapi.dll" ALIAS "UrlIsNoHistoryW" ( BYREF pszURL AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlIsNoHistory = UrlIsNoHistoryW
#ELSE
 MACRO UrlIsNoHistory = UrlIsNoHistoryA
#ENDIF
'#define UrlIsFileUrlA(pszURL) UrlIsA(pszURL, URLIS_FILEURL)
'#define UrlIsFileUrlW(pszURL) UrlIsW(pszURL, URLIS_FILEURL)
DECLARE FUNCTION UrlIsA LIB "shlwapi.dll" ALIAS "UrlIsA" ( BYREF pszUrl AS ASCIIZ , BYVAL UrlIs AS QUAD ) AS LONG
DECLARE FUNCTION UrlIsW LIB "shlwapi.dll" ALIAS "UrlIsW" ( BYREF pszUrl AS WSTRINGZ
 , BYVAL UrlIs AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlIs = UrlIsW
#ELSE
 MACRO UrlIs = UrlIsA
#ENDIF
'MACRO UrlIsFileUrlA(pszURL) = UrlIsA(pszURL, %URLIS_FILEURL)
' // To avoid macro conflicts.
FUNCTION UrlIsFileUrlA ( BYREF pszURL AS ASCIIZ
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "UrlIsA")
 IF pProc THEN CALL DWORD pProc USING UrlIsA(pszURL, %URLIS_FILEURL) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
'MACRO UrlIsFileUrlW(pszURL) = UrlIsW(pszURL, %URLIS_FILEURL)
' // To avoid macro conflicts.
FUNCTION UrlIsFileUrlW ( BYREF pszURL AS WSTRINGZ
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL bRes AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN EXIT FUNCTION
 pProc = GetProcAddress (hLib, "UrlIsW")
 IF pProc THEN CALL DWORD pProc USING UrlIsW(pszURL, %URLIS_FILEURL) TO bRes
 FreeLibrary hLib
 FUNCTION = bRes
END FUNCTION
#IF %DEF(%UNICODE)
 MACRO UrlIsFileUrl = UrlIsFileUrlW
#ELSE
 MACRO UrlIsFileUrl = UrlIsFileUrlA
#ENDIF
DECLARE FUNCTION UrlGetLocationA LIB "shlwapi.dll" ALIAS "UrlGetLocationA" ( BYREF pszURL AS ASCIIZ ) AS QUAD
DECLARE FUNCTION UrlGetLocationW LIB "shlwapi.dll" ALIAS "UrlGetLocationW" ( BYREF pszURL AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO UrlGetLocation = UrlGetLocationW
#ELSE
 MACRO UrlGetLocation = UrlGetLocationA
#ENDIF
DECLARE FUNCTION UrlUnescapeA LIB "shlwapi.dll" ALIAS "UrlUnescapeA" ( BYREF pszURL AS ASCIIZ , BYREF pszUnescaped AS ASCIIZ , BYREF pcchUnescaped AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION UrlUnescapeW LIB "shlwapi.dll" ALIAS "UrlUnescapeW" ( BYREF pszURL AS WSTRINGZ
 , BYREF pszUnescaped AS WSTRINGZ
 , BYREF pcchUnescaped AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlUnescape = UrlUnescapeW
#ELSE
 MACRO UrlUnescape = UrlUnescapeA
#ENDIF
DECLARE FUNCTION UrlEscapeA LIB "shlwapi.dll" ALIAS "UrlEscapeA" ( BYREF pszURL AS ASCIIZ , BYREF pszEscaped AS ASCIIZ , BYREF pcchEscaped AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION UrlEscapeW LIB "shlwapi.dll" ALIAS "UrlEscapeW" ( BYREF pszURL AS WSTRINGZ
 , BYREF pszEscaped AS WSTRINGZ
 , BYREF pcchEscaped AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlEscape = UrlEscapeW
#ELSE
 MACRO UrlEscape = UrlEscapeA
#ENDIF
DECLARE FUNCTION UrlCreateFromPathA LIB "shlwapi.dll" ALIAS "UrlCreateFromPathA" ( BYREF pszPath AS ASCIIZ , BYREF pszUrl AS ASCIIZ , BYREF pcchUrl AS QUAD , BYVAL dwReserved AS QUAD ) AS LONG
DECLARE FUNCTION UrlCreateFromPathW LIB "shlwapi.dll" ALIAS "UrlCreateFromPathW" ( BYREF pszPath AS WSTRINGZ
 , BYREF pszUrl AS WSTRINGZ
 , BYREF pcchUrl AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlCreateFromPath = UrlCreateFromPathW
#ELSE
 MACRO UrlCreateFromPath = UrlCreateFromPathA
#ENDIF
DECLARE FUNCTION PathCreateFromUrlA LIB "shlwapi.dll" ALIAS "PathCreateFromUrlA" ( BYREF pszUrl AS ASCIIZ , BYREF pszPath AS ASCIIZ , BYREF pcchPath AS QUAD , BYVAL dwReserved AS QUAD ) AS LONG
DECLARE FUNCTION PathCreateFromUrlW LIB "shlwapi.dll" ALIAS "PathCreateFromUrlW" ( BYREF pszUrl AS WSTRINGZ
 , BYREF pszPath AS WSTRINGZ
 , BYREF pcchPath AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO PathCreateFromUrl = PathCreateFromUrlW
#ELSE
 MACRO PathCreateFromUrl = PathCreateFromUrlA
#ENDIF
'#if (_WIN32_IE >= _WIN32_IE_IE70)
DECLARE FUNCTION PathCreateFromUrlAlloc LIB "shlwapi.dll" ALIAS "PathCreateFromUrlAlloc" ( BYREF pszIn AS WSTRINGZ , BYREF ppszOut AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
'#endif // _WIN32_IE_IE70
DECLARE FUNCTION UrlHashA LIB "shlwapi.dll" ALIAS "UrlHashA" ( BYREF pszURL AS ASCIIZ , BYREF pbHash AS ANY , BYVAL cbHash AS QUAD ) AS LONG
DECLARE FUNCTION UrlHashW LIB "shlwapi.dll" ALIAS "UrlHashW" ( BYREF pszURL AS WSTRINGZ
 , BYREF pbHash AS ANY
 , BYVAL cbHash AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlHash = UrlHashW
#ELSE
 MACRO UrlHash = UrlHashA
#ENDIF
DECLARE FUNCTION UrlGetPartW LIB "shlwapi.dll" ALIAS "UrlGetPArtW" ( BYREF pszIn AS WSTRINGZ , BYREF pszOut AS WSTRINGZ , BYREF pcchOut AS QUAD , BYVAL dwPart AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION UrlGetPartA LIB "shlwapi.dll" ALIAS "UrlGetPartA" ( BYREF pszIn AS ASCIIZ
 , BYREF pszOut AS ASCIIZ
 , BYREF pcchOut AS DWORD
 , BYVAL dwPart AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlGetPart = UrlGetPartW
#ELSE
 MACRO UrlGetPart = UrlGetPartA
#ENDIF
DECLARE FUNCTION UrlApplySchemeA LIB "shlwapi.dll" ALIAS "UrlApplySchemeA" ( BYREF pszIn AS ASCIIZ , BYREF pszOut AS ASCIIZ , BYREF pcchOut AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION UrlApplySchemeW LIB "shlwapi.dll" ALIAS "UrlApplySchemeW" ( BYREF pszIn AS WSTRINGZ
 , BYREF pszOut AS WSTRINGZ
 , BYREF pcchOut AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UrlApplyScheme = UrlApplySchemeW
#ELSE
 MACRO UrlApplyScheme = UrlApplySchemeA
#ENDIF
DECLARE FUNCTION HashData LIB "shlwapi.dll" ALIAS "HadhData" ( BYVAL pbData AS BYTE PTR , BYVAL cbData AS QUAD , BYREF pbHash AS ANY , BYVAL cbHash AS QUAD ) AS LONG
DECLARE FUNCTION UrlFixupW LIB "shlwapi.dll" ALIAS "UrlFixupW" ( BYREF pszIn AS WSTRINGZ
 , BYREF pszOut AS WSTRINGZ
 , BYVAL cchOut AS DWORD
 ) AS LONG
MACRO UrlFixup = UrlFixupW
'#define UrlEscapeSpaces(pszUrl, pszEscaped, pcchEscaped) UrlCanonicalize(pszUrl, pszEscaped, pcchEscaped, URL_ESCAPE_SPACES_ONLY |URL_DONT_ESCAPE_EXTRA_INFO )
'MACRO UrlEscapeSpacesA(pszUrl, pszEscaped, pcchEscaped) = UrlCanonicalizeA(pszUrl, pszEscaped, pcchEscaped, %URL_ESCAPE_SPACES_ONLY OR %URL_DONT_ESCAPE_EXTRA_INFO)
' // To avoid macro conflicts and to avoid failing if UrlCanonicalizeA does not exist
' // in the version of SHLWAPI.DLL used.
FUNCTION UrlEscapeSpacesA ( BYREF pszUrl AS ASCIIZ
 , BYREF pszEscaped AS ASCIIZ
 , BYREF pcchEscaped AS DWORD
 ) AS LONG
 LOCAL hr AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN
 hr = GetLastError
 ELSE
 pProc = GetProcAddress(hLib, "UrlCanonicalizeA")
 IF pProc = %NULL THEN
 hr = GetLastError
 ELSE
 CALL DWORD pProc USING UrlCanonicalizeA(pszUrl, pszEscaped, pcchEscaped, %URL_ESCAPE_SPACES_ONLY OR %URL_DONT_ESCAPE_EXTRA_INFO) TO hr
 END IF
 FreeLibrary hLib
 END IF
 FUNCTION = hr
END FUNCTION
'MACRO UrlEscapeSpacesW(pszUrl, pszEscaped, pcchEscaped) = UrlCanonicalizeW(pszUrl, pszEscaped, pcchEscaped, %URL_ESCAPE_SPACES_ONLY OR %URL_DONT_ESCAPE_EXTRA_INFO)
' // To avoid macro conflicts and to avoid failing if UrlCanonicalizeA does not exist
' // in the version of SHLWAPI.DLL used.
FUNCTION UrlEscapeSpacesW ( BYREF pszUrl AS WSTRINGZ
 , BYREF pszEscaped AS WSTRINGZ
 , BYREF pcchEscaped AS DWORD
 ) AS LONG
 LOCAL hr AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN
 hr = GetLastError
 ELSE
 pProc = GetProcAddress(hLib, "UrlCanonicalizeW")
 IF pProc = %NULL THEN
 hr = GetLastError
 ELSE
 CALL DWORD pProc USING UrlCanonicalizeW(pszUrl, pszEscaped, pcchEscaped, %URL_ESCAPE_SPACES_ONLY OR %URL_DONT_ESCAPE_EXTRA_INFO) TO hr
 END IF
 FreeLibrary hLib
 END IF
 FUNCTION = hr
END FUNCTION
#IF %DEF(%UNICODE)
 MACRO UrlEscapeSpaces = UrlEscapeSpacesW
#ELSE
 MACRO UrlEscapeSpaces = UrlEscapeSpacesA
#ENDIF
'#define UrlUnescapeInPlace(pszUrl, dwFlags) UrlUnescape(pszUrl, NULL, NULL, dwFlags | URL_UNESCAPE_INPLACE)
'MACRO UrlUnescapeInPlaceA(pszUrl, dwFlags) = UrlUnescapeA(pszUrl, BYVAL %NULL, BYVAL %NULL, dwFlags OR %URL_UNESCAPE_INPLACE)
' // To avoid macro conflicts and to avoid failing if UrlUnescapeA does not exist
' // in the version of SHLWAPI.DLL used.
FUNCTION UrlUnescapeInPlaceA ( BYREF pszUrl AS ASCIIZ
 , BYVAL dwFlags AS DWORD
 ) AS LONG
 LOCAL hr AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN
 hr = GetLastError
 ELSE
 pProc = GetProcAddress(hLib, "UrlUnescapeA")
 IF pProc = %NULL THEN
 hr = GetLastError
 ELSE
 CALL DWORD pProc USING UrlUnescapeA(pszUrl, BYVAL %NULL, BYVAL %NULL, dwFlags OR %URL_UNESCAPE_INPLACE) TO hr
 END IF
 FreeLibrary hLib
 END IF
 FUNCTION = hr
END FUNCTION
'MACRO UrlUnescapeInPlaceW(pszUrl, dwFlags) = UrlUnescapeW(pszUrl, BYVAL %NULL, BYVAL %NULL, dwFlags OR %URL_UNESCAPE_INPLACE)
' // To avoid macro conflicts and to avoid failing if UrlUnescapeA does not exist
' // in the version of SHLWAPI.DLL used.
FUNCTION UrlUnescapeInPlaceW ( BYREF pszUrl AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 ) AS LONG
 LOCAL hr AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN
 hr = GetLastError
 ELSE
 pProc = GetProcAddress(hLib, "UrlUnescapeW")
 IF pProc = %NULL THEN
 hr = GetLastError
 ELSE
 CALL DWORD pProc USING UrlUnescapeW(pszUrl, BYVAL %NULL, BYVAL %NULL, dwFlags OR %URL_UNESCAPE_INPLACE) TO hr
 END IF
 FreeLibrary hLib
 END IF
 FUNCTION = hr
END FUNCTION
#IF %DEF(%UNICODE)
 MACRO UrlUnescapeInPlace = UrlUnescapeInPlaceW
#ELSE
 MACRO UrlUnescapeInPlace = UrlUnescapeInPlaceA
#ENDIF
'#if (_WIN32_IE >= _WIN32_IE_IE50)
'#IF (%WIN32_IE >= %WIN32_IE_IE50)
' // Size = 24 bytes
TYPE PARSEDURLA DWORD
 cbSize AS DWORD
 ' // Pointers into the buffer that was provided to ParseURL
 pszProtocol AS ASCIIZ PTR
 cchProtocol AS DWORD ' UINT
 pszSuffix AS ASCIIZ PTR
 cchSuffix AS DWORD ' UINT
 nScheme AS DWORD ' UINT // One of URL_SCHEME_*
END TYPE
' // Size = 24 bytes
TYPE PARSEDURLW DWORD
 cbSize AS DWORD
 ' // Pointers into the buffer that was provided to ParseURL
 pszProtocol AS WSTRINGZ PTR
 cchProtocol AS DWORD ' UINT
 pszSuffix AS WSTRINGZ PTR
 cchSuffix AS DWORD ' UINT
 nScheme AS DWORD ' UINT // One of URL_SCHEME_*
END TYPE
#IF %DEF(%UNICODE)
 MACRO PARSEDURL = PARSEDURLW
#ELSE
 MACRO PARSEDURL = PARSEDURLA
#ENDIF
DECLARE FUNCTION ParseURLA LIB "shlwapi.dll" ALIAS "ParseURLA" ( BYREF pcszURL AS ASCIIZ , BYREF ppu AS PARSEDURLA ) AS LONG
DECLARE FUNCTION ParseURLW LIB "shlwapi.dll" ALIAS "ParseURLW" ( BYREF pcszURL AS WSTRINGZ
 , BYREF ppu AS PARSEDURLW
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ParseURL = ParseURLW
#ELSE
 MACRO ParseURL = ParseURLA
#ENDIF
'#ENDIF ' // _WIN32_IE_IE50
'#endif // _WIN32_IE_IE50
#ENDIF ' // NO_SHLWAPI_PATH
#IF NOT %DEF(%NO_SHLWAPI_REG)
'//
'//=============== Registry Routines ===================================
'//
'// SHDeleteEmptyKey mimics RegDeleteKey as it behaves on NT.
'// SHDeleteKey mimics RegDeleteKey as it behaves on Win95.
DECLARE FUNCTION SHDeleteEmptyKeyA LIB "shlwapi.dll" ALIAS "SHDeleteEmptyKeyA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ ) AS LONG ' LSTATUS
DECLARE FUNCTION SHDeleteEmptyKeyW LIB "shlwapi.dll" ALIAS "SHDeleteEmptyKeyW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHDeleteEmptyKey = SHDeleteEmptyKeyW
#ELSE
 MACRO SHDeleteEmptyKey = SHDeleteEmptyKeyA
#ENDIF
DECLARE FUNCTION SHDeleteKeyA LIB "shlwapi.dll" ALIAS "SHDeleteKeyA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ ) AS LONG ' LSTATUS
DECLARE FUNCTION SHDeleteKeyW LIB "shlwapi.dll" ALIAS "SHDeleteKeyW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHDeleteKey = SHDeleteKeyW
#ELSE
 MACRO SHDeleteKey = SHDeleteKeyA
#ENDIF
DECLARE FUNCTION SHRegDuplicateKey LIB "shlwapi.dll" ALIAS "SHRegDuplicateKey" ( BYVAL hkey AS QUAD ) AS QUAD ' HKEY
'// These functions open the key, get/set/delete the value, then close
'// the key.
DECLARE FUNCTION SHDeleteValueA LIB "shlwapi.dll" ALIAS "SHDeleteValueA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ ) AS LONG ' LSTATUS
DECLARE FUNCTION SHDeleteValueW LIB "shlwapi.dll" ALIAS "SHDeleteValueW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHDeleteValue = SHDeleteValueW
#ELSE
 MACRO SHDeleteValue = SHDeleteValueA
#ENDIF
DECLARE FUNCTION SHGetValueA LIB "shlwapi.dll" ALIAS "SHGetValueA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHGetValueW LIB "shlwapi.dll" ALIAS "SHGetValueW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHGetValue = SHGetValueW
#ELSE
 MACRO SHGetValue = SHGetValueA
#ENDIF
DECLARE FUNCTION SHSetValueA LIB "shlwapi.dll" ALIAS "SHSetValueA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYVAL dwType AS QUAD , BYREF pvData AS ANY , BYVAL cbData AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHSetValueW LIB "shlwapi.dll" ALIAS "SHSetValueW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYVAL dwType AS QUAD , BYREF pvData AS ANY , BYVAL cbData AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHSetValue = SHSetValueW
#ELSE
 MACRO SHSetValue = SHSetValueA
#ENDIF
'#if (_WIN32_IE >= 0x0602)
'//
'// SRRF - Shell Registry Routine Flags (for SHRegGetValue)
'//
'typedef int SRRF; ' // Prevously defined as DWORD
%EQUATE `SRRF_RT_REG_NONE = &H00000001& ' // restrict type to REG_NONE (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_REG_SZ = &H00000002& ' // restrict type to REG_SZ (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_REG_EXPAND_SZ = &H00000004& ' // restrict type to REG_EXPAND_SZ (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_REG_BINARY = &H00000008& ' // restrict type to REG_BINARY (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_REG_DWORD = &H00000010& ' // restrict type to REG_DWORD (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_REG_MULTI_SZ = &H00000020& ' // restrict type to REG_MULTI_SZ (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_REG_QWORD = &H00000040& ' // restrict type to REG_QWORD (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_DWORD = (%SRRF_RT_REG_BINARY OR %SRRF_RT_REG_DWORD) ' // restrict type to *32-bit* SRRF_RT_REG_BINARY or SRRF_RT_REG_DWORD (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_QWORD = (%SRRF_RT_REG_BINARY OR %SRRF_RT_REG_QWORD) ' // restrict type to *64-bit* SRRF_RT_REG_BINARY or SRRF_RT_REG_DWORD (other data types will not return ERROR_SUCCESS)
%EQUATE `SRRF_RT_ANY = &H0000ffff& ' // no type restriction
%EQUATE `SRRF_RM_ANY = &H00000000& ' // no mode restriction (default is to allow any mode)
%EQUATE `SRRF_RM_NORMAL = &H00010000& ' // restrict system startup mode to "normal boot" (other startup modes will not return ERROR_SUCCESS)
%EQUATE `SRRF_RM_SAFE = &H00020000& ' // restrict system startup mode to "safe mode" (other startup modes will not return ERROR_SUCCESS)
%EQUATE `SRRF_RM_SAFENETWORK = &H00040000& ' // restrict system startup mode to "safe mode with networking" (other startup modes will not return ERROR_SUCCESS)
%EQUATE `SRRF_NOEXPAND = &H10000000& ' // do not automatically expand environment strings if value is of type REG_EXPAND_SZ
%EQUATE `SRRF_ZEROONFAILURE = &H20000000& ' // if pvData is not NULL, set content to all zeros on failure
%EQUATE `SRRF_NOVIRT = &H40000000& ' // if the requested key is virtualized, then fail with ERROR_FILE_NOT_FOUND
'// Function:
'//
'// SHRegGetValue()
'//
'// Purpose:
'//
'// Gets a registry value. SHRegGetValue() provides the following benefits:
'//
'// - data type checking
'// - boot mode checking
'// - auto-expansion of REG_EXPAND_SZ data
'// - guaranteed NULL termination of REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ data
'//
'// Parameters:
'//
'// hkey - handle to a currently open key.
'//
'// pszSubKey - pointer to a null-terminated string specifying the relative
'// path from hkey to one of its subkeys from which the data is
'// to be retrieved. this will be opened with KEY_READ sam.
'//
'// Note1: pszSubKey can be NULL or "". In either of these two
'// cases, the data is retrieved from the hkey itself.
'// Note2: *** PERF ***
'// If pszSubKey is not NULL or "", the subkey will be
'// automatically be opened and closed by this routine
'// in order to obtain the data. If you are retrieving
'// multiple values from the same subkey, it is better
'// for perf to open the subkey via RegOpenKeyEx() prior
'// to calling this method, and using this opened key as
'// hkey with pszSubKey set to NULL.
'//
'// pszValue - pointer to a null-terminated string specifying the name of
'// the value to query for data
'//
'// Note1: pszValue can be NULL or "". In either of these two
'// cases, the data is retrieved from the unnamed or
'// default value.
'//
'// dwFlags - bitwise or of SRRF_ flags, which cannot be 0: at least one
'// type restriction must be specified (SRRF_RT_...), or if any
'// type is desired then SRRF_RT_ANY can be specified
'//
'// Note1: SRRF_RT_ANY will allow any data type to be returned.
'// Note2: The following two type restrictions have special
'// handling semantics:
'//
'// SRRF_RT_DWORD == SRRF_RT_REG_BINARY | SRRF_RT_REG_DWORD
'// SRRF_RT_QWORD == SRRF_RT_REG_BINARY | SRRF_RT_REG_QWORD
'//
'// If either of these are specified, with no other type
'// restrictions, then in the prior case the restriction
'// will limit "valid" returned data to either REG_DWORD
'// or 32-bit REG_BINARY data, and in the latter case
'// the restriction will limit "valid" returned data to
'// either REG_QWORD or 64-bit REG_BINARY.
'//
'// pdwType - pointer to a dword which receives a code indicating the
'// type of data stored in the specified value
'//
'// Note1: pdwType can be NULL if no type information is wanted
'// Note2: If pdwType is not NULL, and the SRRF_NOEXPAND flag
'// has not been set, data types of REG_EXPAND_SZ will
'// be returned as REG_SZ since they are automatically
'// expanded in this method.
'//
'// pvData - pointer to a buffer that receives the value's data
'//
'// Note1: pvData can be NULL if the data is not required.
'// pvData is usually NULL if doing either a simple
'// existence test, or if interested in the size only.
'// Note2: *** PERF ***
'// Reference 'perf' note for pcbData.
'//
'// pcbData - when pvData is NULL:
'// optional pointer to a dword that receives a size in bytes
'// which would be sufficient to hold the registry data (note
'// this size is not guaranteed to be exact, merely sufficient)
'// when pvData is not NULL:
'// required pointer to a dword that specifies the size in
'// bytes of the buffer pointed to by the pvData parameter
'// and receives a size in bytes of:
'// a) the number of bytes read into pvData on ERROR_SUCCESS
'// (note this size is guaranteed to be exact)
'// b) the number of bytes which would be sufficient to hold
'// the registry data on ERROR_MORE_DATA -- pvData was of
'// insufficient size (note this size is not guaranteed to
'// be exact, merely sufficient)
'//
'// Note1: pcbData can be NULL only if pvData is NULL.
'// Note2: *** PERF ***
'// The potential for an 'extra' call to the registry to
'// read (or re-read) in the data exists when the data
'// type is REG_EXPAND_SZ and the SRRF_NOEXPAND flag has
'// not been set. The following conditions will result
'// in this 'extra' read operation:
'// i) when pvData is NULL and pcbData is not NULL
'// we must read in the data from the registry
'// anyway in order to obtain the string and perform
'// an expand on it to obtain and return the total
'// required size in pcbData
'// ii) when pvData is not NULL but is of insufficient
'// size we must re-read in the data from the
'// registry in order to obtain the entire string
'// and perform an expand on it to obtain and return
'// the total required size in pcbData
'//
'// Remarks:
'//
'// The key identified by hkey must have been opened with KEY_QUERY_VALUE
'// access. If pszSubKey is not NULL or "", it must be able to be opened
'// with KEY_QUERY_VALUE access in the current calling context.
'//
'// If the data type is REG_SZ, REG_EXPAND_SZ or REG_MULTI_SZ then any
'// returned data is guaranteed to take into account proper null termination.
'// For example: if pcbData is not NULL, its returned size will include the
'// bytes for a null terminator if pvData is not NULL, its returned data
'// will be properly null terminated.
'//
'// If the data type is REG_EXPAND_SZ, then unless the SRRF_NOEXPAND flag
'// is set the data will be automatically expanded prior to being returned.
'// For example: if pdwType is not NULL, its returned type will be changed
'// to REG_SZ, if pcbData is not NULL, its returned size will include the
'// bytes for a properly expanded string. if pvData is not NULL, its
'// returned data will be the expanded version of the string.
'//
'// Reference MSDN documentation for RegQueryValueEx() for more information
'// of the behaviour when pdwType, pvData, and/or pcbData are equal to NULL.
'//
'// Return Values:
'//
'// If the function succeeds, the return value is ERROR_SUCCESS and all out
'// parameters requested (pdwType, pvData, pcbData) are valid.
'//
'// If the function fails due to insufficient space in a provided non-NULL
'// pvData, the return value is ERROR_MORE_DATA and only pdwType and pcbData
'// can contain valid data. The content of pvData in this case is undefined.
'//
'// Examples:
'//
'// 1) read REG_SZ (or REG_EXPAND_SZ as REG_SZ) "string" data from the (default) value of an open hkey
'//
'// TCHAR szData[128]
'// DWORD cbData = sizeof(pszData)
'// if (ERROR_SUCCESS == SHRegGetValue(hkey, NULL, NULL, SRRF_RT_REG_SZ, NULL, szData, &cbData))
'// {
'// // use sz (successful read)
'// }
'//
'// 2) read REG_SZ (or REG_EXPAND_SZ as REG_SZ) "string" data of unknown size from the "MyValue" value of an open hkey
'//
'// DWORD cbData
'// if (ERROR_SUCCESS == SHRegGetValue(hkey, NULL, TEXT("MyValue"), SRRF_RT_REG_SZ, NULL, NULL, &cbData))
'// {
'// TCHAR *pszData = new TCHAR[cbData/sizeof(TCHAR)]
'// if (pszData)
'// {
'// if (ERROR_SUCCESS == SHRegGetValue(hkey, NULL, TEXT("MyValue"), SRRF_RT_REG_SZ, NULL, pszData, &cbData))
'// {
'// // use pszData (successful read)
'// }
'// delete[] pszData
'// }
'// }
'//
'// 3) read "dword" data from the "MyValue" value of the "MySubKey" subkey of an open hkey
'//
'// DWORD dwData
'// DWORD cbData = sizeof(dwData)
'// if (ERROR_SUCCESS == SHRegGetValue(hkey, TEXT("MySubKey"), TEXT("MyValue"), SRRF_RT_REG_DWORD, NULL, &dwData, &cbData))
'// {
'// // use dwData (successful read)
'// }
'//
'// 4) read "dword" data from the "MyValue" value of the "MySubKey" subkey of an open hkey (32-bit binary data also ok)
'//
'// DWORD dwData
'// DWORD cbData = sizeof(dwData)
'// if (ERROR_SUCCESS == SHRegGetValue(hkey, TEXT("MySubKey"), TEXT("MyValue"), SRRF_RT_DWORD, NULL, &dwData, &cbData))
'// {
'// // use dwData (successful read)
'// }
'//
'// 5) determine existence of "MyValue" value of an open hkey
'//
'// BOOL bExists = ERROR_SUCCESS == SHRegGetValue(hkey, NULL, TEXT("MyValue"), SRRF_RT_ANY, NULL, NULL, NULL)
DECLARE FUNCTION SHRegGetValueA LIB "shlwapi.dll" ALIAS "SHRegGetValueA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYVAL srrfFlags AS LONG , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegGetValueW LIB "shlwapi.dll" ALIAS "SHRegGetValueW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYVAL srrfFlags AS LONG , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegGetValue = SHRegGetValueW
#ELSE
 MACRO SHRegGetValue = SHRegGetValueA
#ENDIF
' Not currently supported. Use RegSetValue in its place.
'DECLARE FUNCTION SHRegSetValue LIB "shlwapi.dll" ALIAS "SHRegSetValue" ( ' BYVAL hkey AS DWORD
' , BYREF pszSubKey AS WSTRINGZ
' , BYREF pszValue AS WSTRINGZ
' , BYVAL srrfFlags AS LONG
' , BYVAL dwType AS DWORD
' , BYREF pvData AS ANY
' , BYVAL cbData AS DWORD
' ) AS LONG ' LSTATUS
' Not currently supported.
'DECLARE FUNCTION SHRegGetValueFromHKCUHKLM LIB "shlwapi.dll" ALIAS "SHRegGetValueFromHKCUHKLM" ( ' BYREF pwszKey AS WSTRINGZ
' , BYREF pwszValue AS WSTRINGZ
' , BYVAL srrfFlags AS LONG
' , BYREF pdwType AS DWORD
' , BYREF pvData AS ANY
' , BYREF pcbData AS DWORD
' ) AS LONG ' LSTATUS
' Not currently supported.
'DECLARE FUNCTION SHRegGetBoolValueFromHKCUHKLM LIB "shlwapi.dll" ALIAS "SHRegGetBoolValueFromHKCUHKLM" ( ' BYREF pwszKey AS WSTRINGZ
' , BYREF pwszValue AS WSTRINGZ
' , BYVAL fDefault AS LONG
' ) AS LONG ' LSTATUS
'#endif // (_WIN32_IE >= 0x0602)
'// These functions behave just like RegQueryValueEx(), except if the data
'// type is REG_SZ, REG_EXPAND_SZ or REG_MULTI_SZ then the string is
'// guaranteed to be properly null terminated.
'//
'// Additionally, if the data type is REG_EXPAND_SZ these functions will
'// go ahead and expand out the string, and "massage" the returned *pdwType
'// to be REG_SZ.
DECLARE FUNCTION SHQueryValueExA LIB "shlwapi.dll" ALIAS "SHQueryValueExA" ( BYVAL hkey AS QUAD , BYREF pszValue AS ASCIIZ , BYREF pdwReserved AS QUAD , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHQueryValueExW LIB "shlwapi.dll" ALIAS "SHQueryValueExW" ( BYVAL hkey AS QUAD , BYREF pszValue AS WSTRINGZ , BYREF pdwReserved AS QUAD , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHQueryValueEx = SHQueryValueExW
#ELSE
 MACRO SHQueryValueEx = SHQueryValueExA
#ENDIF
'// Enumeration functions support.
DECLARE FUNCTION SHEnumKeyExA LIB "shlwapi.dll" ALIAS "SHEnumKeyExA" ( BYVAL hkey AS QUAD , BYVAL dwIndex AS QUAD , BYREF pszName AS ASCIIZ , BYREF pcchName AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHEnumKeyExW LIB "shlwapi.dll" ALIAS "SHEnumKeyExW" ( BYVAL hkey AS QUAD , BYVAL dwIndex AS QUAD , BYREF pszName AS WSTRINGZ , BYREF pcchName AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHEnumKeyEx = SHEnumKeyExW
#ELSE
 MACRO SHEnumKeyEx = SHEnumKeyExA
#ENDIF
DECLARE FUNCTION SHEnumValueA LIB "shlwapi.dll" ALIAS "SHEnumValueA" ( BYVAL hkey AS QUAD , BYVAL dwIndex AS QUAD , BYREF pszValueName AS ASCIIZ , BYREF pcchValueName AS QUAD , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHEnumValueW LIB "shlwapi.dll" ALIAS "SHEnumValueW" ( BYVAL hkey AS QUAD , BYVAL dwIndex AS QUAD , BYREF pszValueName AS WSTRINGZ , BYREF pcchValueName AS QUAD , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHEnumValue = SHEnumValueW
#ELSE
 MACRO SHEnumValue = SHEnumValueA
#ENDIF
DECLARE FUNCTION SHQueryInfoKeyA LIB "shlwapi.dll" ALIAS "SHQueryInfoKeyA" ( BYVAL hkey AS QUAD , BYREF pcSubKeys AS QUAD , BYREF pcchMaxSubKeyLen AS QUAD , BYREF pcValues AS QUAD , BYREF pcchMaxValueNameLen AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHQueryInfoKeyW LIB "shlwapi.dll" ALIAS "SHQueryInfoKeyWA" ( BYVAL hkey AS QUAD , BYREF pcSubKeys AS QUAD , BYREF pcchMaxSubKeyLen AS QUAD , BYREF pcValues AS QUAD , BYREF pcchMaxValueNameLen AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHQueryInfoKey = SHQueryInfoKeyW
#ELSE
 MACRO SHQueryInfoKey = SHQueryInfoKeyA
#ENDIF
'// recursive key copy
DECLARE FUNCTION SHCopyKeyA LIB "shlwapi.dll" ALIAS "SHCopyKeyA" ( BYVAL hkey AS QUAD , BYREF szSrcSubKey AS ASCIIZ , BYVAL hkeyDest AS QUAD , BYVAL fReserved AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHCopyKeyW LIB "shlwapi.dll" ALIAS "SHCopyKeyW" ( BYVAL hkey AS QUAD , BYREF szSrcSubKey AS WSTRINGZ , BYVAL hkeyDest AS QUAD , BYVAL fReserved AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHCopyKey = SHCopyKeyW
#ELSE
 MACRO SHCopyKey = SHCopyKeyA
#ENDIF
'// Getting and setting file system paths with environment variables
DECLARE FUNCTION SHRegGetPathA LIB "shlwapi.dll" ALIAS "SHRegGetPathA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYREF pszPath AS ASCIIZ , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegGetPathW LIB "shlwapi.dll" ALIAS "SHRegGetPathW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYREF pszPath AS WSTRINGZ , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegGetPath = SHRegGetPathW
#ELSE
 MACRO SHRegGetPath = SHRegGetPathA
#ENDIF
DECLARE FUNCTION SHRegSetPathA LIB "shlwapi.dll" ALIAS "SHRegSetPathA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYREF pszPath AS ASCIIZ , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegSetPathW LIB "shlwapi.dll" ALIAS "SHRegSetPathW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYREF pszPath AS WSTRINGZ , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegSetPath = SHRegSetPathW
#ELSE
 MACRO SHRegSetPath = SHRegSetPathA
#ENDIF
'//////////////////////////////////////////////
'// User Specific Registry Access Functions
'//////////////////////////////////////////////
' SHREGDEL_FLAGS enum
%EQUATE `SHREGDEL_DEFAULT = &H00000000 ' // Delete's HKCU, or HKLM if HKCU is not found.
%EQUATE `SHREGDEL_HKCU = &H00000001 ' // Delete HKCU only
%EQUATE `SHREGDEL_HKLM = &H00000010 ' // Delete HKLM only.
%EQUATE `SHREGDEL_BOTH = &H00000011 ' // Delete both HKCU and HKLM.
' SHREGENUM_FLAGS enum
%EQUATE `SHREGENUM_DEFAULT = &H00000000 ' // Enumerates HKCU or HKLM if not found.
%EQUATE `SHREGENUM_HKCU = &H00000001 ' // Enumerates HKCU only
%EQUATE `SHREGENUM_HKLM = &H00000010 ' // Enumerates HKLM only.
%EQUATE `SHREGENUM_BOTH = &H00000011 ' // Enumerates both HKCU and HKLM without duplicates.
 ' // This option is NYI.
%EQUATE `SHREGSET_HKCU = &H00000001 ' // Write to HKCU if empty.
%EQUATE `SHREGSET_FORCE_HKCU = &H00000002 ' // Write to HKCU.
%EQUATE `SHREGSET_HKLM = &H00000004 ' // Write to HKLM if empty.
%EQUATE `SHREGSET_FORCE_HKLM = &H00000008 ' // Write to HKLM.
%EQUATE `SHREGSET_DEFAULT = (%SHREGSET_FORCE_HKCU OR %SHREGSET_HKLM) ' // Default is SHREGSET_FORCE_HKCU | SHREGSET_HKLM.
'typedef HANDLE HUSKEY; // HUSKEY is a Handle to a User Specific KEY.
'typedef HUSKEY *PHUSKEY;
DECLARE FUNCTION SHRegCreateUSKeyA LIB "shlwapi.dll" ALIAS "SHRegCreateUSKeyA" ( BYREF pszPath AS ASCIIZ , BYVAL samDesired AS REGSAM , BYVAL hRelativeUSKey AS QUAD , BYREF phNewUSKey AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegCreateUSKeyW LIB "shlwapi.dll" ALIAS "SHRegCreateUSKeyW" ( BYREF pszPath AS WSTRINGZ , BYVAL samDesired AS REGSAM , BYVAL hRelativeUSKey AS QUAD , BYREF phNewUSKey AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegCreateUSKey = SHRegCreateUSKeyW
#ELSE
 MACRO SHRegCreateUSKey = SHRegCreateUSKeyA
#ENDIF
DECLARE FUNCTION SHRegOpenUSKeyA LIB "shlwapi.dll" ALIAS "SHRegOpenUSKeyA" ( BYREF pszPath AS ASCIIZ , BYVAL samDesired AS REGSAM , BYVAL hRelativeUSKey AS QUAD , BYREF phNewUSKey AS QUAD , BYVAL fIgnoreHKCU AS LONG ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegOpenUSKeyW LIB "shlwapi.dll" ALIAS "SHRegOpenUSKeyW" ( BYREF pszPath AS WSTRINGZ , BYVAL samDesired AS REGSAM , BYVAL hRelativeUSKey AS QUAD , BYREF phNewUSKey AS QUAD , BYVAL fIgnoreHKCU AS LONG ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegOpenUSKey = SHRegOpenUSKeyW
#ELSE
 MACRO SHRegOpenUSKey = SHRegOpenUSKeyA
#ENDIF
DECLARE FUNCTION SHRegQueryUSValueA LIB "shlwapi.dll" ALIAS "SHRegQueryUSValueA" ( BYVAL hUSKey AS QUAD , BYREF pszValue AS ASCIIZ , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD , BYVAL fIgnoreHKCU AS LONG , BYREF pvDefaultData AS ANY , BYVAL dwDefaultDataSize AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegQueryUSValueW LIB "shlwapi.dll" ALIAS "SHRegQueryUSValueW" ( BYVAL hUSKey AS QUAD , BYREF pszValue AS WSTRINGZ , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD , BYVAL fIgnoreHKCU AS LONG , BYREF pvDefaultData AS ANY , BYVAL dwDefaultDataSize AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegQueryUSValue = SHRegQueryUSValueW
#ELSE
 MACRO SHRegQueryUSValue = SHRegQueryUSValueA
#ENDIF
DECLARE FUNCTION SHRegWriteUSValueA LIB "shlwapi.dll" ALIAS "SHRegWriteUSValueA" ( BYVAL hUSKey AS QUAD , BYREF pszValue AS ASCIIZ , BYVAL dwType AS QUAD , BYREF pvData AS ANY , BYVAL cbData AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegWriteUSValueW LIB "shlwapi.dll" ALIAS "SHRegWriteUSValueW" ( BYVAL hUSKey AS QUAD , BYREF pszValue AS WSTRINGZ , BYVAL dwType AS QUAD , BYREF pvData AS ANY , BYVAL cbData AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegWriteUSValue = SHRegWriteUSValueW
#ELSE
 MACRO SHRegWriteUSValue = SHRegWriteUSValueA
#ENDIF
DECLARE FUNCTION SHRegDeleteUSValueA LIB "shlwapi.dll" ALIAS "SHRegDeleteUSValueA" ( BYVAL hUSKey AS QUAD , BYREF pszValue AS ASCIIZ , BYVAL delRegFlags AS LONG ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegDeleteUSValueW LIB "shlwapi.dll" ALIAS "SHRegDeleteUSValueW" ( BYVAL hUSKey AS QUAD , BYREF pszValue AS WSTRINGZ , BYVAL delRegFlags AS LONG ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegDeleteUSValue = SHRegDeleteUSValueW
#ELSE
 MACRO SHRegDeleteUSValue = SHRegDeleteUSValueA
#ENDIF
DECLARE FUNCTION SHRegDeleteEmptyUSKeyA LIB "shlwapi.dll" ALIAS "SHRegDeleteEmptyUSKeyA" ( BYVAL hUSKey AS QUAD , BYREF pszValue AS ASCIIZ , BYVAL delRegFlags AS LONG ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegDeleteEmptyUSKeyW LIB "shlwapi.dll" ALIAS "SHRegDeleteEmptyUSKeyW" ( BYVAL hUSKey AS QUAD , BYREF pszValue AS WSTRINGZ , BYVAL delRegFlags AS LONG ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegDeleteEmptyUSKey = SHRegDeleteEmptyUSKeyW
#ELSE
 MACRO SHRegDeleteEmptyUSKey = SHRegDeleteEmptyUSKeyA
#ENDIF
DECLARE FUNCTION SHRegEnumUSKeyA LIB "shlwapi.dll" ALIAS "SHRegEnumUSKeyA" ( BYVAL hUSKey AS QUAD , BYVAL dwIndex AS QUAD , BYREF pszName AS ASCIIZ , BYREF pcchName AS QUAD , BYVAL enumRegFlags AS LONG ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegEnumUSKeyW LIB "shlwapi.dll" ALIAS "SHRegEnumUSKeyW" ( BYVAL hUSKey AS QUAD , BYVAL dwIndex AS QUAD , BYREF pszName AS WSTRINGZ , BYREF pcchName AS QUAD , BYVAL enumRegFlags AS LONG ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegEnumUSKey = SHRegEnumUSKeyW
#ELSE
 MACRO SHRegEnumUSKey = SHRegEnumUSKeyA
#ENDIF
DECLARE FUNCTION SHRegEnumUSValueA LIB "shlwapi.dll" ALIAS "SHRegEnumUSValueA" ( BYVAL hUSKey AS QUAD , BYVAL dwIndex AS QUAD , BYREF pszValueName AS ASCIIZ , BYREF pcchValueNameLen AS QUAD , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD , BYVAL enumRegFlags AS LONG ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegEnumUSValueW LIB "shlwapi.dll" ALIAS "SHRegEnumUSValueW" ( BYVAL hUSKey AS QUAD , BYVAL dwIndex AS QUAD , BYREF pszValueName AS WSTRINGZ , BYREF pcchValueNameLen AS QUAD , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD , BYVAL enumRegFlags AS LONG ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegEnumUSValue = SHRegEnumUSValueW
#ELSE
 MACRO SHRegEnumUSValue = SHRegEnumUSValueA
#ENDIF
DECLARE FUNCTION SHRegQueryInfoUSKeyA LIB "shlwapi.dll" ALIAS "SHRegQueryInfoUSKeyA" ( BYVAL hUSKey AS QUAD , BYREF pcSubKeys AS QUAD , BYREF pcchMaxSubKeyLen AS QUAD , BYREF pcValues AS QUAD , BYREF pcchMaxValueNameLen AS QUAD , BYVAL enumRegFlags AS LONG ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegQueryInfoUSKeyW LIB "shlwapi.dll" ALIAS "SHRegQueryInfoUSKeyW" ( BYVAL hUSKey AS QUAD , BYREF pcSubKeys AS QUAD , BYREF pcchMaxSubKeyLen AS QUAD , BYREF pcValues AS QUAD , BYREF pcchMaxValueNameLen AS QUAD , BYVAL enumRegFlags AS LONG ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegQueryInfoUSKey = SHRegQueryInfoUSKeyW
#ELSE
 MACRO SHRegQueryInfoUSKey = SHRegQueryInfoUSKeyA
#ENDIF
DECLARE FUNCTION SHRegCloseUSKey LIB "shlwapi.dll" ALIAS "SHRegCloseUSKey" ( BYVAL hUSKey AS QUAD ) AS LONG ' LSTATUS
'// These calls are equal to an SHRegOpenUSKey, SHRegQueryUSValue, and then a SHRegCloseUSKey.
DECLARE FUNCTION SHRegGetUSValueA LIB "shlwapi.dll" ALIAS "SHRegGetUSValueA" ( BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD , BYVAL fIgnoreHKCU AS LONG , BYREF pvDefaultData AS ANY , BYVAL dwDefaultDataSize AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegGetUSValueW LIB "shlwapi.dll" ALIAS "SHRegGetUSValueW" ( BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYREF pdwType AS QUAD , BYREF pvData AS ANY , BYREF pcbData AS QUAD , BYVAL fIgnoreHKCU AS LONG , BYREF pvDefaultData AS ANY , BYVAL dwDefaultDataSize AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegGetUSValue = SHRegGetUSValueW
#ELSE
 MACRO SHRegGetUSValue = SHRegGetUSValueA
#ENDIF
DECLARE FUNCTION SHRegSetUSValueA LIB "shlwapi.dll" ALIAS "SHRegSetUSValueA" ( BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYVAL dwType AS QUAD , BYREF pvData AS ANY , BYVAL cbData AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
DECLARE FUNCTION SHRegSetUSValueW LIB "shlwapi.dll" ALIAS "SHRegSetUSValueW" ( BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYVAL dwType AS QUAD , BYREF pvData AS ANY , BYVAL cbData AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' LSTATUS
#IF %DEF(%UNICODE)
 MACRO SHRegSetUSValue = SHRegSetUSValueW
#ELSE
 MACRO SHRegSetUSValue = SHRegSetUSValueA
#ENDIF
' NOTE: Implemented as Unicode version only.
DECLARE FUNCTION SHRegGetIntW LIB "shlwapi.dll" ALIAS "SHRegGetIntW" ( BYVAL hk AS QUAD , BYREF szKey AS WSTRINGZ , BYVAL nDefault AS LONG ) AS LONG ' int
MACRO SHRegGetInt = SHRegGetIntW
DECLARE FUNCTION SHRegGetBoolUSValueA LIB "shlwapi.dll" ALIAS "SHRegGetBoolUSValueA" ( BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYVAL fIgnoreHKCU AS LONG , BYVAL fDefault AS LONG ) AS LONG
DECLARE FUNCTION SHRegGetBoolUSValueW LIB "shlwapi.dll" ALIAS "SHRegGetBoolUSValueW" ( BYREF pszSubKey AS WSTRINGZ
 , BYREF pszValue AS WSTRINGZ
 , BYVAL fIgnoreHKCU AS LONG
 , BYVAL fDefault AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SHRegGetBoolUSValue = SHRegGetBoolUSValueW
#ELSE
 MACRO SHRegGetBoolUSValue = SHRegGetBoolUSValueA
#ENDIF
'//
'// Association APIs
'//
'// these APIs are to assist in accessing the data in HKCR
'// getting the Command strings and exe paths
'// for different verbs and extensions are simplified this way
'//
%EQUATE `ASSOCF_INIT_NOREMAPCLSID = &H00000001 ' // do not remap clsids to progids
%EQUATE `ASSOCF_INIT_BYEXENAME = &H00000002 ' // executable is being passed in
%EQUATE `ASSOCF_OPEN_BYEXENAME = &H00000002 ' // executable is being passed in
%EQUATE `ASSOCF_INIT_DEFAULTTOSTAR = &H00000004 ' // treat "*" as the BaseClass
%EQUATE `ASSOCF_INIT_DEFAULTTOFOLDER = &H00000008 ' // treat "Folder" as the BaseClass
%EQUATE `ASSOCF_NOUSERSETTINGS = &H00000010 ' // dont use HKCU
%EQUATE `ASSOCF_NOTRUNCATE = &H00000020 ' // dont truncate the return string
%EQUATE `ASSOCF_VERIFY = &H00000040 ' // verify data is accurate (DISK HITS)
%EQUATE `ASSOCF_REMAPRUNDLL = &H00000080 ' // actually gets info about rundlls target if applicable
%EQUATE `ASSOCF_NOFIXUPS = &H00000100 ' // attempt to fix errors if found
%EQUATE `ASSOCF_IGNOREBASECLASS = &H00000200 ' // dont recurse into the baseclass
%EQUATE `ASSOCF_INIT_IGNOREUNKNOWN = &H00000400 ' // dont use the "Unknown" progid, instead fail
'typedef DWORD ASSOCF;
' ASSOCSTR enum
%EQUATE `ASSOCSTR_COMMAND = 1 ' // shell\verb\command string
%EQUATE `ASSOCSTR_EXECUTABLE = 2 ' // the executable part of command string
%EQUATE `ASSOCSTR_FRIENDLYDOCNAME = 3 ' // friendly name of the document type
%EQUATE `ASSOCSTR_FRIENDLYAPPNAME = 4 ' // friendly name of executable
%EQUATE `ASSOCSTR_NOOPEN = 5 ' // noopen value
%EQUATE `ASSOCSTR_SHELLNEWVALUE = 6 ' // query values under the shellnew key
%EQUATE `ASSOCSTR_DDECOMMAND = 7 ' // template for DDE commands
%EQUATE `ASSOCSTR_DDEIFEXEC = 8 ' // DDECOMMAND to use if just create a process
%EQUATE `ASSOCSTR_DDEAPPLICATION = 9 ' // Application name in DDE broadcast
%EQUATE `ASSOCSTR_DDETOPIC = 10 ' // Topic Name in DDE broadcast
%EQUATE `ASSOCSTR_INFOTIP = 11 ' // info tip for an item, or list of properties to create info tip from
'#if (_WIN32_IE >= _WIN32_IE_IE60)
%EQUATE `ASSOCSTR_QUICKTIP = 12 ' // same as ASSOCSTR_INFOTIP, except, this list contains only quickly retrievable properties
%EQUATE `ASSOCSTR_TILEINFO = 13 ' // similar to ASSOCSTR_INFOTIP - lists important properties for tileview
%EQUATE `ASSOCSTR_CONTENTTYPE = 14 ' // MIME Content type
%EQUATE `ASSOCSTR_DEFAULTICON = 15 ' // Default icon source
%EQUATE `ASSOCSTR_SHELLEXTENSION = 16 ' // Guid string pointing to the Shellex\Shellextensionhandler value.
'#endif // _WIN32_IE_IE60
'#if (_WIN32_IE >= _WIN32_IE_IE80)
%EQUATE `ASSOCSTR_DROPTARGET = 17 ' // The CLSID of DropTarget
%EQUATE `ASSOCSTR_DELEGATEEXECUTE = 18 ' // The CLSID of DelegateExecute
'#endif // _WIN32_IE_IE80
%EQUATE `ASSOCSTR_MAX = 19 ' // last item in enum...
' ASSOCKEY enum
%EQUATE `ASSOCKEY_SHELLEXECCLASS = 1 ' // the key that should be passed to ShellExec(hkeyClass)
%EQUATE `ASSOCKEY_APP = 2 ' // the "Application" key for the association
%EQUATE `ASSOCKEY_CLASS = 3 ' // the progid or class key
%EQUATE `ASSOCKEY_BASECLASS = 4 ' // the BaseClass key
%EQUATE `ASSOCKEY_MAX = 4 ' // last item in enum...
' ASSOCDATA enum
%EQUATE `ASSOCDATA_MSIDESCRIPTOR = 1 ' // Component Descriptor to pass to MSI APIs
%EQUATE `ASSOCDATA_NOACTIVATEHANDLER = 2 ' // restrict attempts to activate window
%EQUATE `ASSOCDATA_QUERYCLASSSTORE = 3 ' // should check with the NT Class Store
%EQUATE `ASSOCDATA_HASPERUSERASSOC = 4 ' // defaults to user specified association
'#if (_WIN32_IE >= _WIN32_IE_IE60)
%EQUATE `ASSOCDATA_EDITFLAGS = 5 ' // Edit flags.
%EQUATE `ASSOCDATA_VALUE = 6 ' // use pszExtra as the Value name
'#endif // _WIN32_IE_IE60
%EQUATE `ASSOCDATA_MAX = 6
' ASSOCENUM enum
%EQUATE `ASSOCENUM_NONE = 0
' ########################################################################################
' IQueryAssociations interface
' IID = C46CA590-3C3F-11D2-BEE6-0000F805CA57
' Inherited interface = IUnknown
' Minimum operating systems: Windows 2000, Windows NT 4.0 with Internet Explorer 5,
' Windows 98, Windows 95 with Internet Explorer 5
' ########################################################################################
$IID_IQueryAssociations = GUID$("{C46CA590-3C3F-11D2-BEE6-0000F805CA57}")
INTERFACE IQueryAssociations $IID_IQueryAssociations
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Init ( ' VTable offset = 12
 BYVAL flags AS DWORD
 , BYREF pszAssoc AS WSTRINGZ
 , BYVAL hkProgid AS DWORD
 , BYVAL hwnd AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetString ( ' VTable offset = 16
 BYVAL flags AS DWORD
 , BYVAL str AS DWORD
 , BYREF pszExtra AS WSTRINGZ
 , BYREF pszOut AS WSTRINGZ
 , BYREF pcchOut AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetKey ( ' VTable offset = 20
 BYVAL flags AS DWORD
 , BYVAL key AS DWORD
 , BYREF pszExtra AS WSTRINGZ
 , BYREF phkeyOut AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetData ( ' VTable offset = 24
 BYVAL flags AS DWORD
 , BYVAL data AS DWORD
 , BYREF pszExtra AS WSTRINGZ
 , BYREF pvOut AS DWORD
 , BYREF pcbOut AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetEnum ( ' VTable offset = 28
 BYVAL flags AS DWORD
 , BYVAL assocenum AS DWORD
 , BYREF pszExtra AS WSTRINGZ
 , BYREF riid AS GUID
 , BYREF ppvOut AS IUnknown
 ) AS LONG
 ' =====================================================================================
END INTERFACE
DECLARE FUNCTION AssocCreate LIB "shlwapi.dll" ALIAS "AssocCreate" ( BYREF clsid AS GUID , BYREF riid AS GUID , BYREF pqa AS ANY ) AS LONG
'// wrappers for the interface
DECLARE FUNCTION AssocQueryStringA LIB "shlwapi.dll" ALIAS "AssocQueryStringA" ( BYVAL flags AS LONG , BYVAL str AS LONG , BYREF pszAssoc AS ASCIIZ , BYREF pszExtra AS ASCIIZ , BYREF pszOut AS ASCIIZ , BYREF pcchOut AS QUAD ) AS LONG
DECLARE FUNCTION AssocQueryStringW LIB "shlwapi.dll" ALIAS "AssocQueryStringW" ( BYVAL flags AS LONG
 , BYVAL str AS LONG
 , BYREF pszAssoc AS WSTRINGZ
 , BYREF pszExtra AS WSTRINGZ
 , BYREF pszOut AS WSTRINGZ
 , BYREF pcchOut AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AssocQueryString = AssocQueryStringW
#ELSE
 MACRO AssocQueryString = AssocQueryStringA
#ENDIF
DECLARE FUNCTION AssocQueryStringByKeyA LIB "shlwapi.dll" ALIAS "AssocQueryStringByKeyA" ( BYVAL flags AS LONG , BYVAL str AS LONG , BYVAL hkAssoc AS QUAD , BYREF pszExtra AS ASCIIZ , BYREF pszOut AS ASCIIZ , BYREF pcchOut AS QUAD ) AS LONG
DECLARE FUNCTION AssocQueryStringByKeyW LIB "shlwapi.dll" ALIAS "AssocQueryStringByKeyW" ( BYVAL flags AS LONG
 , BYVAL str AS LONG
 , BYVAL hkAssoc AS DWORD
 , BYREF pszExtra AS WSTRINGZ
 , BYREF pszOut AS WSTRINGZ
 , BYREF pcchOut AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AssocQueryStringByKey = AssocQueryStringByKeyW
#ELSE
 MACRO AssocQueryStringByKey = AssocQueryStringByKeyA
#ENDIF
DECLARE FUNCTION AssocQueryKeyA LIB "shlwapi.dll" ALIAS "AssocQueryKeyA" ( BYVAL flags AS LONG , BYVAL key AS LONG , BYREF pszAssoc AS ASCIIZ , BYREF pszExtra AS ASCIIZ , BYREF phkeyOut AS QUAD ) AS LONG
DECLARE FUNCTION AssocQueryKeyW LIB "shlwapi.dll" ALIAS "AssocQueryKeyW" ( BYVAL flags AS LONG
 , BYVAL key AS LONG
 , BYREF pszAssoc AS WSTRINGZ
 , BYREF pszExtra AS WSTRINGZ
 , BYREF phkeyOut AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO AssocQueryKey = AssocQueryKeyW
#ELSE
 MACRO AssocQueryKey = AssocQueryKeyA
#ENDIF
'#if (_WIN32_IE >= 0x0601)
'#IF (%WIN32_IE >= &H0601)
'// AssocIsDangerous() checks a file type to determine whether it is "Dangerous"
'// this maps to the IE download dialog's forcing a prompt to open or save.
'// dangerous file types should be handled more carefully than other file types.
'//
'// Parameter: pszAssoc - type to check. may be an extension or progid. (".exe" or "exefile" would both be valid)
'//
'// Returns: TRUE if the file type is dangerous.
'//
'// NOTES:
'//
'// this API first checks a hardcoded list of known dangerous types.
'// then it checks the editflags for the file type looking for the FTA_AlwaysUnsafe bit.
'// then it checks Safer policies.
'//
'LWSTDAPI_(BOOL) AssocIsDangerous(LPCWSTR pszAssoc);
DECLARE FUNCTION AssocIsDangerous LIB "shlwapi.dll" ALIAS "AssocIsDangerous" ( BYREF pszAssoc AS WSTRINGZ ) AS LONG
'#ENDIF ' // %WIN32_IE >= &H0601
'#endif // (_WIN32_IE >= 0x0601)
'#if (_WIN32_IE >= _WIN32_IE_IE60SP2)
'#IF (%WIN32_IE >= %WIN32_IE_IE60SP2)
DECLARE FUNCTION AssocGetPerceivedType LIB "shlwapi.dll" ALIAS "AssocGetPerceivedType" ( BYREF pszExt AS WSTRINGZ , BYREF ptype AS QUAD , BYREF pflag AS QUAD , BYREF ppszType AS QUAD ) AS LONG
'#ENDIF
'#endif
#ENDIF ' // NO_SHLWAPI_REG
#IF NOT %DEF(%NO_SHLWAPI_STREAM)
'//
'//=============== Stream Routines ===================================
'//
DECLARE FUNCTION SHOpenRegStreamA LIB "shlwapi.dll" ALIAS "SHOpenRegStreamA" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYVAL grfMode AS QUAD ) AS IStream ' IStream *
DECLARE FUNCTION SHOpenRegStreamW LIB "shlwapi.dll" ALIAS "SHOpenRegStreamW" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYVAL grfMode AS QUAD ) AS IStream ' IStream *
#IF %DEF(%UNICODE)
 MACRO SHOpenRegStream = SHOpenRegStreamW
#ELSE
 MACRO SHOpenRegStream = SHOpenRegStreamA
#ENDIF
DECLARE FUNCTION SHOpenRegStream2A LIB "shlwapi.dll" ALIAS "SHOpenRegStream2A" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS ASCIIZ , BYREF pszValue AS ASCIIZ , BYVAL grfMode AS QUAD ) AS IStream ' IStream *
DECLARE FUNCTION SHOpenRegStream2W LIB "shlwapi.dll" ALIAS "SHOpenRegStream2W" ( BYVAL hkey AS QUAD , BYREF pszSubKey AS WSTRINGZ , BYREF pszValue AS WSTRINGZ , BYVAL grfMode AS QUAD ) AS IStream ' IStream *
#IF %DEF(%UNICODE)
 MACRO SHOpenRegStream2 = SHOpenRegStream2W
#ELSE
 MACRO SHOpenRegStream2 = SHOpenRegStream2A
#ENDIF
DECLARE FUNCTION SHCreateStreamOnFileA LIB "shlwapi.dll" ALIAS "SHCreateStreamOnFileA" ( BYREF pszFile AS ASCIIZ , BYVAL grfMode AS QUAD , BYREF ppstm AS IStream ) AS LONG
DECLARE FUNCTION SHCreateStreamOnFileW LIB "shlwapi.dll" ALIAS "SHCreateStreamOnFileW" ( BYREF pszFile AS WSTRINGZ
 , BYVAL grfMode AS DWORD
 , BYREF ppstm AS IStream
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SHCreateStreamOnFile = SHCreateStreamOnFileW
#ELSE
 MACRO SHCreateStreamOnFile = SHCreateStreamOnFileA
#ENDIF
'#if (_WIN32_IE >= 0x0600)
'#IF (%WIN32_IE >= &H0600)
DECLARE FUNCTION SHCreateStreamOnFileEx LIB "shlwapi.dll" ALIAS "SHCreateStreamOnFileEx" ( BYREF pszFile AS WSTRINGZ , BYVAL grfMode AS QUAD , BYVAL dwAttributes AS QUAD , BYVAL fCreate AS LONG , BYVAL pstmTemplate AS IStream , BYREF ppstm AS IStream ) AS LONG
'#ENDIF ' // (%WIN32_IE >= &H0600)
'#endif // (_WIN32_IE >= 0x0600)
'#if (_WIN32_IE >= _WIN32_IE_IE501)
'#IF (%WIN32_IE >= %WIN32_IE_IE501)
DECLARE FUNCTION SHCreateMemStream LIB "shlwapi.dll" ALIAS "SHCreateMemStream" ( BYVAL pInit AS BYTE PTR , BYVAL cbInit AS QUAD ) AS IStream ' IStream *
'#ENDIF ' // (%WIN32_IE >= %WIN32_IE_IE501)
'#endif // (_WIN32_IE >= _WIN32_IE_IE501)
#ENDIF ' // NO_SHLWAPI_STREAM
'#IF NOT %DEF(%NO_SHLWAPI_MLUI)
'//
'//=============== Multi Language UI Routines ===================================
'//
' *** Removed in Windows 7 SDK ***
'#if (_WIN32_IE >= _WIN32_IE_IE501)
'DECLARE FUNCTION MLLoadLibrary LIB "shlwapi.dll" ALIAS "MLLoadLibraryA" ( ' BYREF lpLibFileName AS ASCIIZ
' , BYVAL hModule AS DWORD
' , BYVAL dwCrossCodePage AS DWORD
' ) AS DWORD ' HINSTANCE
'DECLARE FUNCTION MLLoadLibraryW LIB "shlwapi.dll" ALIAS "MLLoadLibraryW" ( ' BYREF lpLibFileName AS WSTRINGZ
' , BYVAL hModule AS DWORD
' , BYVAL dwCrossCodePage AS DWORD
' ) AS DWORD ' HINSTANCE
'DECLARE FUNCTION MLFreeLibrary LIB "shlwapi.dll" ALIAS "MLFreeLibrary" ( ' BYVAL hModule AS DWORD
' ) AS LONG
'%ML_NO_CROSSCODEPAGE = 0
'%ML_CROSSCODEPAGE_NT = 1
'%ML_CROSSCODEPAGE = 2
'%ML_SHELL_LANGUAGE = 4
'%ML_CROSSCODEPAGE_MASK = 7
'#endif // (_WIN32_IE >= _WIN32_IE_IE501)
'#ENDIF ' // NO_SHLWAPI_MLUI
#IF NOT %DEF(%NO_SHLWAPI_HTTP)
'//
'//=============== HTTP helper Routines ===================================
'//
'#if (_WIN32_IE >= 0x0603)
DECLARE FUNCTION GetAcceptLanguagesA LIB "shlwapi.dll" ALIAS "GetAcceptLanguagesA" ( BYREF psz AS ASCIIZ , BYREF pcch AS QUAD ) AS LONG
DECLARE FUNCTION GetAcceptLanguagesW LIB "shlwapi.dll" ALIAS "GetAcceptLanguagesW" ( BYREF psz AS WSTRINGZ
 , BYREF pcch AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetAcceptLanguages = GetAcceptLanguagesW
#ELSE
 MACRO GetAcceptLanguages = GetAcceptLanguagesA
#ENDIF
'#endif // (_WIN32_IE >= 0x0603)
#ENDIF ' // NO_SHLWAPI_HTTP
'#if (_WIN32_IE < _WIN32_IE_IE70) && !defined(NO_SHLWAPI_STOPWATCH)
%EQUATE `SPMODE_SHELL = &H00000001
%EQUATE `SPMODE_DEBUGOUT = &H00000002
%EQUATE `SPMODE_TEST = &H00000004
%EQUATE `SPMODE_BROWSER = &H00000008
%EQUATE `SPMODE_FLUSH = &H00000010
%EQUATE `SPMODE_EVENT = &H00000020
%EQUATE `SPMODE_MSVM = &H00000040
%EQUATE `SPMODE_FORMATTEXT = &H00000080
%EQUATE `SPMODE_PROFILE = &H00000100
%EQUATE `SPMODE_DEBUGBREAK = &H00000200
%EQUATE `SPMODE_MSGTRACE = &H00000400
%EQUATE `SPMODE_PERFTAGS = &H00000800
%EQUATE `SPMODE_MEMWATCH = &H00001000
%EQUATE `SPMODE_DBMON = &H00002000
%EQUATE `SPMODE_MULTISTOP = &H00004000
#IF NOT %DEF(%NO_ETW_TRACING)
%EQUATE `SPMODE_EVENTTRACE = &H00008000 ' // Event Tracing for Windows Enabled
#ENDIF
DECLARE FUNCTION StopWatchMode LIB "shlwapi.dll" ALIAS "StopWatchMode" ( ) AS QUAD
DECLARE FUNCTION StopWatchFlush LIB "shlwapi.dll" ALIAS "StopWatchFlush" ( ) AS QUAD
'#endif // (_WIN32_IE < _WIN32_IE_IE70) && !defined(NO_SHLWAPI_STOPWATCH)
'#if (_WIN32_IE >= _WIN32_IE_IE501)
DECLARE SUB IUnknown_Set LIB "shlwapi.dll" ALIAS "IUnknown_Set" ( BYREF ppunk AS IUnknown , BYVAL punk AS IUnknown ) ' void
DECLARE SUB IUnknown_AtomicRelease LIB "shlwapi.dll" ALIAS "IUnknown_AtomicRelease" ( BYREF ppunk AS IUnknown ) ' void
DECLARE FUNCTION IUnknown_GetWindow LIB "shlwapi.dll" ALIAS "IUnknown_GetWindow" ( BYVAL punk AS IUnknown , BYREF phwnd AS QUAD ) AS LONG
DECLARE FUNCTION IUnknown_SetSite LIB "shlwapi.dll" ALIAS "IUnknown_SetSite" ( BYVAL punk AS IUnknown
 , BYVAL punkSite AS IUnknown
 ) AS LONG
DECLARE FUNCTION IUnknown_GetSite LIB "shlwapi.dll" ALIAS "IUnknown_GetSite" ( BYVAL punk AS IUnknown
 , BYREF riid AS GUID
 , BYREF ppv AS IUnknown
 ) AS LONG
' For those versions of Windows that do not include IUnknown_QueryService in Shlwapi.h,
' this function must be called directly from Shlwapi.dll using ordinal 176.
DECLARE FUNCTION IUnknown_QueryService LIB "shlwapi.dll" ALIAS "IUnknown_QueryService" ( BYVAL punk AS IUnknown , BYREF guidService AS GUID , BYREF riid AS GUID , BYREF ppvOut AS IUnknown ) AS LONG
'#endif // (_WIN32_IE >= _WIN32_IE_IE501)
'#if (_WIN32_IE >= _WIN32_IE_IE501)
DECLARE FUNCTION IStream_Read LIB "shlwapi.dll" ALIAS "IStream_Read" ( BYVAL pstm AS IStream , BYREF pv AS ANY , BYVAL cb AS QUAD ) AS LONG
DECLARE FUNCTION IStream_Write LIB "shlwapi.dll" ALIAS "IStream_Write" ( BYVAL pstm AS IStream
 , BYREF pv AS ANY
 , BYVAL cb AS DWORD
 ) AS LONG
DECLARE FUNCTION IStream_Reset LIB "shlwapi.dll" ALIAS "IStream_Reset" ( BYVAL pstm AS IStream
 ) AS LONG
DECLARE FUNCTION IStream_Size LIB "shlwapi.dll" ALIAS "IStream_Size" ( BYVAL pstm AS IStream
 , BYREF pui AS QUAD
 ) AS LONG
DECLARE FUNCTION ConnectToConnectionPoint LIB "shlwapi.dll" ALIAS "ConnectToConnectionPoint" ( BYVAL punk AS IUnknown
 , BYREF riidEvent AS GUID
 , BYVAL fConnect AS LONG
 , BYVAL punkTarget AS IUnknown
 , BYREF pdwCookie AS DWORD
 , BYREF ppcpOut AS IConnectionPoint
 ) AS LONG
'#endif // (_WIN32_IE >= _WIN32_IE_IE501)
'#if (_WIN32_IE >= _WIN32_IE_IE60)
DECLARE FUNCTION IStream_ReadPidl LIB "shlwapi.dll" ALIAS "IStream_ReadPidl" ( BYVAL pstm AS IStream , BYREF ppidlOut AS ANY ) AS LONG
DECLARE FUNCTION IStream_WritePidl LIB "shlwapi.dll" ALIAS "IStream_WritePidl" ( BYVAL pstm AS IStream
 , BYVAL pidlWrite AS DWORD
 ) AS LONG
'#endif // (_WIN32_IE >= _WIN32_IE_IE60)
'#if (_WIN32_IE >= _WIN32_IE_IE70)
DECLARE FUNCTION IStream_ReadStr LIB "shlwapi.dll" ALIAS "IStream_ReadStr" ( BYVAL pstm AS IStream , BYREF ppsz AS QUAD ) AS LONG
DECLARE FUNCTION IStream_WriteStr LIB "shlwapi.dll" ALIAS "IStream_WriteStr" ( BYVAL pstm AS IStream
 , BYREF psz AS WSTRINGZ
 ) AS LONG
DECLARE FUNCTION IStream_Copy LIB "shlwapi.dll" ALIAS "IStream_Copy" ( BYVAL pstm AS IStream
 , BYVAL pstmTo AS IStream
 , BYVAL cb AS DWORD
 ) AS LONG
'#endif // (_WIN32_IE >= _WIN32_IE_IE70)
'#if (_WIN32_IE >= 0x0600)
%EQUATE `SHGVSPB_PERUSER = &H00000001 ' // must have one of PERUSER or ALLUSERS
%EQUATE `SHGVSPB_ALLUSERS = &H00000002
%EQUATE `SHGVSPB_PERFOLDER = &H00000004 ' // must have one of PERFOLDER ALLFOLDERS or INHERIT
%EQUATE `SHGVSPB_ALLFOLDERS = &H00000008
%EQUATE `SHGVSPB_INHERIT = &H00000010
%EQUATE `SHGVSPB_ROAM = &H00000020 ' // modifies the above
%EQUATE `SHGVSPB_NOAUTODEFAULTS = &H80000000 ' // turns off read delegation to more general property bags
%EQUATE `SHGVSPB_FOLDER = (%SHGVSPB_PERUSER OR %SHGVSPB_PERFOLDER)
%EQUATE `SHGVSPB_FOLDERNODEFAULTS = (%SHGVSPB_PERUSER OR %SHGVSPB_PERFOLDER OR %SHGVSPB_NOAUTODEFAULTS)
%EQUATE `SHGVSPB_USERDEFAULTS = (%SHGVSPB_PERUSER OR %SHGVSPB_ALLFOLDERS)
%EQUATE `SHGVSPB_GLOBALDEFAULTS = (%SHGVSPB_ALLUSERS OR %SHGVSPB_ALLFOLDERS)
DECLARE FUNCTION SHGetViewStatePropertyBag LIB "shlwapi.dll" ALIAS "SHGetViewStatePropertyBag" ( BYVAL pidl AS ITEMIDLIST PTR , BYREF pszBagName AS WSTRINGZ , BYVAL dwFlags AS QUAD , BYREF riid AS GUID , BYREF ppv AS ANY ) AS LONG
'#endif // (_WIN32_IE >= 0x0600)
'// SHFormatDateTime flags
'// (FDTF_SHORTDATE and FDTF_LONGDATE are mutually exclusive, as is
'// FDTF_SHORTIME and FDTF_LONGTIME.)
'//
%EQUATE `FDTF_SHORTTIME = &H00000001 ' // eg, "7:48 PM"
%EQUATE `FDTF_SHORTDATE = &H00000002 ' // eg, "3/29/98"
%EQUATE `FDTF_DEFAULT = %FDTF_SHORTDATE OR %FDTF_SHORTTIME ' // eg, "3/29/98 7:48 PM"
%EQUATE `FDTF_LONGDATE = &H00000004 ' // eg, "Monday, March 29, 1998"
%EQUATE `FDTF_LONGTIME = &H00000008 ' // eg. "7:48:33 PM"
%EQUATE `FDTF_RELATIVE = &H00000010 ' // uses "Yesterday", etc. if possible
%EQUATE `FDTF_LTRDATE = &H00000100 ' // Left To Right reading order
%EQUATE `FDTF_RTLDATE = &H00000200 ' // Right To Left reading order
%EQUATE `FDTF_NOAUTOREADINGORDER = &H00000400 ' // Don't detect reading order automatically. Useful if you will be converting to Ansi and don't want Unicode reading order characters
DECLARE FUNCTION SHFormatDateTimeA LIB "shlwapi.dll" ALIAS "SHFormatDateTimeA" ( BYREF pft AS FILETIME , BYREF pdwFlags AS QUAD , BYREF pszBuf AS ASCIIZ , BYVAL cchBuf AS QUAD ) AS LONG ' int
DECLARE FUNCTION SHFormatDateTimeW LIB "shlwapi.dll" ALIAS "SHFormatDateTimeW" ( BYREF pft AS FILETIME , BYREF pdwFlags AS QUAD , BYREF pszBuf AS WSTRINGZ , BYVAL cchBuf AS QUAD ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO SHFormatDateTime = SHFormatDateTimeW
#ELSE
 MACRO SHFormatDateTime = SHFormatDateTimeA
#ENDIF
'#if (_WIN32_IE >= _WIN32_IE_IE501)
DECLARE FUNCTION SHAnsiToUnicode LIB "shlwapi.dll" ALIAS "SHAnsiToUnicode" ( BYREF pszSrc AS ASCIIZ , BYREF pwszDst AS WSTRINGZ , BYVAL cwchBuf AS LONG ) AS LONG ' int
DECLARE FUNCTION SHAnsiToAnsi LIB "shlwapi.dll" ALIAS "SHAnsiToAnsi" ( BYREF pszSrc AS ASCIIZ , BYREF pszDst AS ASCIIZ , BYVAL cchBuf AS LONG ) AS LONG ' int
DECLARE FUNCTION SHUnicodeToAnsi LIB "shlwapi.dll" ALIAS "SHUnicodeToAnsi" ( BYREF pwszSrc AS WSTRINGZ , BYREF pszDst AS ASCIIZ , BYVAL cchBuf AS LONG ) AS LONG ' int
DECLARE FUNCTION SHUnicodeToUnicode LIB "shlwapi.dll" ALIAS "SHUnicodeToUnicode" ( BYREF pwszSrc AS WSTRINGZ , BYREF pwszDst AS WSTRINGZ , BYVAL cwchBuf AS LONG ) AS LONG ' int
'// The return value from all SH<Type>To<Type> is the size of szDest including the terminater.
'#ifdef UNICODE
'#define SHTCharToUnicode(wzSrc, wzDest, cchSize) SHUnicodeToUnicode(wzSrc, wzDest, cchSize)
'#define SHTCharToAnsi(wzSrc, szDest, cchSize) SHUnicodeToAnsi(wzSrc, szDest, cchSize)
'#define SHUnicodeToTChar(wzSrc, wzDest, cchSize) SHUnicodeToUnicode(wzSrc, wzDest, cchSize)
'#define SHAnsiToTChar(szSrc, wzDest, cchSize) SHAnsiToUnicode(szSrc, wzDest, cchSize)
'#else // UNICODE
'#define SHTCharToUnicode(szSrc, wzDest, cchSize) SHAnsiToUnicode(szSrc, wzDest, cchSize)
'#define SHTCharToAnsi(szSrc, szDest, cchSize) SHAnsiToAnsi(szSrc, szDest, cchSize)
'#define SHUnicodeToTChar(wzSrc, szDest, cchSize) SHUnicodeToAnsi(wzSrc, szDest, cchSize)
'#define SHAnsiToTChar(szSrc, szDest, cchSize) SHAnsiToAnsi(szSrc, szDest, cchSize)
'#endif // UNICODE
'#if (_WIN32_IE >= _WIN32_IE_IE501)
DECLARE FUNCTION SHMessageBoxCheckA LIB "shlwapi.dll" ALIAS "SHMessageBoxCheckA" ( BYVAL hwnd AS QUAD , BYREF pszText AS ASCIIZ , BYREF pszCaption AS ASCIIZ , BYVAL uType AS QUAD , BYVAL iDefault AS LONG , BYREF pszRegVal AS ASCIIZ ) AS LONG ' int
DECLARE FUNCTION SHMessageBoxCheckW LIB "shlwapi.dll" ALIAS "SHMessageBoxCheckW" ( BYVAL hwnd AS QUAD , BYREF pszText AS WSTRINGZ , BYREF pszCaption AS WSTRINGZ , BYVAL uType AS QUAD , BYVAL iDefault AS LONG , BYVAL pszRegVal AS QUAD ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO SHMessageBoxCheck = SHMessageBoxCheckW
#ELSE
 MACRO SHMessageBoxCheck = SHMessageBoxCheckA
#ENDIF
'#endif // (_WIN32_IE >= _WIN32_IE_IE501)
'#if (_WIN32_IE >= _WIN32_IE_IE501)
'// Prevents hang do to hung window on broadcast
DECLARE FUNCTION SHSendMessageBroadcastA LIB "shlwapi.dll" ALIAS "SHSendMessageBroadcastA" ( BYVAL uMsg AS QUAD , BYVAL wParam AS QUAD , BYVAL lParam AS LONG ) AS LONG ' LRESULT
'// Prevents hang do to hung window on broadcast
DECLARE FUNCTION SHSendMessageBroadcastW LIB "shlwapi.dll" ALIAS "SHSendMessageBroadcastW" ( BYVAL uMsg AS QUAD , BYVAL wParam AS QUAD , BYVAL lParam AS LONG ) AS LONG ' LRESULT
#IF %DEF(%UNICODE)
 MACRO SHSendMessageBroadcast = SHSendMessageBroadcastW
#ELSE
 MACRO SHSendMessageBroadcast = SHSendMessageBroadcastA
#ENDIF
DECLARE FUNCTION SHStripMneumonicA LIB "shlwapi.dll" ALIAS "SHStripMneumonicA" ( BYREF pszMenu AS ASCIIZ ) AS BYTE ' CHAR
DECLARE FUNCTION SHStripMneumonicW LIB "shlwapi.dll" ALIAS "SHStripMneumonicW" ( BYREF pszMenu AS WSTRINGZ ) AS WORD ' WCHAR
#IF %DEF(%UNICODE)
 MACRO SHStripMneumonic = SHStripMneumonicW
#ELSE
 MACRO SHStripMneumonic = SHStripMneumonicA
#ENDIF
#IF NOT %DEF(%NO_SHLWAPI_ISOS)
'// Returns TRUE/FALSE depending on question
%EQUATE `OS_WINDOWS = 0 ' // Windows 9x vs. NT
%EQUATE `OS_NT = 1 ' // Windows 9x vs. NT
%EQUATE `OS_WIN95ORGREATER = 2 ' // Win95 or greater
%EQUATE `OS_NT4ORGREATER = 3 ' // NT4 or greater
%EQUATE `OS_WIN98ORGREATER = 5 ' // Win98 or greater
%EQUATE `OS_WIN98_GOLD = 6 ' // Win98 Gold (Version 4.10 build 1998)
%EQUATE `OS_WIN2000ORGREATER = 7 ' // Some derivative of Win2000
'// NOTE: these flags check explicitly for (dwMajorVersion == 5)
%EQUATE `OS_WIN2000PRO = 8 ' // Windows 2000 Professional (Workstation)
%EQUATE `OS_WIN2000SERVER = 9 ' // Windows 2000 Server
%EQUATE `OS_WIN2000ADVSERVER = 10 ' // Windows 2000 Advanced Server
%EQUATE `OS_WIN2000DATACENTER = 11 ' // Windows 2000 Data Center Server
%EQUATE `OS_WIN2000TERMINAL = 12 ' // Windows 2000 Terminal Server in "Application Server" mode (now simply called "Terminal Server")
%EQUATE `OS_EMBEDDED = 13 ' // Embedded Windows Edition
%EQUATE `OS_TERMINALCLIENT = 14 ' // Windows Terminal Client (eg user is comming in via tsclient)
%EQUATE `OS_TERMINALREMOTEADMIN = 15 ' // Terminal Server in "Remote Administration" mode
%EQUATE `OS_WIN95_GOLD = 16 ' // Windows 95 Gold (Version 4.0 Build 1995)
%EQUATE `OS_MEORGREATER = 17 ' // Windows Millennium (Version 5.0)
%EQUATE `OS_XPORGREATER = 18 ' // Windows XP or greater
%EQUATE `OS_HOME = 19 ' // Home Edition (eg NOT Professional, Server, Advanced Server, or Datacenter)
%EQUATE `OS_PROFESSIONAL = 20 ' // Professional (aka Workstation; eg NOT Server, Advanced Server, or Datacenter)
%EQUATE `OS_DATACENTER = 21 ' // Datacenter (eg NOT Server, Advanced Server, Professional, or Personal)
%EQUATE `OS_ADVSERVER = 22 ' // Advanced Server (eg NOT Datacenter, Server, Professional, or Personal)
%EQUATE `OS_SERVER = 23 ' // Server (eg NOT Datacenter, Advanced Server, Professional, or Personal)
%EQUATE `OS_TERMINALSERVER = 24 ' // Terminal Server - server running in what used to be called "Application Server" mode (now simply called "Terminal Server")
%EQUATE `OS_PERSONALTERMINALSERVER = 25 ' // Personal Terminal Server - per/pro machine running in single user TS mode
%EQUATE `OS_FASTUSERSWITCHING = 26 ' // Fast User Switching
%EQUATE `OS_WELCOMELOGONUI = 27 ' // New friendly logon UI
%EQUATE `OS_DOMAINMEMBER = 28 ' // Is this machine a member of a domain (eg NOT a workgroup)
%EQUATE `OS_ANYSERVER = 29 ' // is this machine any type of server? (eg datacenter or advanced server or server)?
%EQUATE `OS_WOW6432 = 30 ' // Is this process a 32-bit process running on an 64-bit platform?
%EQUATE `OS_WEBSERVER = 31 ' // Web Edition Server
%EQUATE `OS_SMALLBUSINESSSERVER = 32 ' // SBS Server
%EQUATE `OS_TABLETPC = 33 ' // Are we running on a TabletPC?
%EQUATE `OS_SERVERADMINUI = 34 ' // Should defaults lean towards those preferred by server administrators?
%EQUATE `OS_MEDIACENTER = 35 ' // eHome Freestyle Project
%EQUATE `OS_APPLIANCE = 36 ' // Windows .NET Appliance Server
DECLARE FUNCTION IsOS LIB "shlwapi.dll" ALIAS "IsOS" ( BYVAL dwOS AS QUAD ) AS LONG
#ENDIF ' // NO_SHLWAPI_ISOS
'#endif // (_WIN32_IE >= _WIN32_IE_IE501)
' enum SHGLOBALCOUNTER
%EQUATE `GLOBALCOUNTER_SEARCHMANAGER = 0
%EQUATE `GLOBALCOUNTER_SEARCHOPTIONS = 1
%EQUATE `GLOBALCOUNTER_FOLDERSETTINGSCHANGE = 2
%EQUATE `GLOBALCOUNTER_RATINGS = 3
%EQUATE `GLOBALCOUNTER_APPROVEDSITES = 4
%EQUATE `GLOBALCOUNTER_RESTRICTIONS = 5
%EQUATE `GLOBALCOUNTER_SHELLSETTINGSCHANGED = 6
%EQUATE `GLOBALCOUNTER_SYSTEMPIDLCHANGE = 7
%EQUATE `GLOBALCOUNTER_OVERLAYMANAGER = 8
%EQUATE `GLOBALCOUNTER_QUERYASSOCIATIONS = 9
%EQUATE `GLOBALCOUNTER_IESESSIONS = 10
%EQUATE `GLOBALCOUNTER_IEONLY_SESSIONS = 11
%EQUATE `GLOBALCOUNTER_APPLICATION_DESTINATIONS = 12
%EQUATE `GLOBALCOUNTER_BITBUCKETNUMDELETERS = 14
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_SHARES = 15
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_A = 16
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_B = 17
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_C = 18
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_D = 19
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_E = 20
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_F = 21
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_G = 22
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_H = 23
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_I = 24
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_J = 25
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_K = 26
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_L = 27
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_M = 28
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_N = 29
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_O = 30
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_P = 31
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_Q = 32
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_R = 33
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_S = 34
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_T = 35
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_U = 36
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_V = 37
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_W = 38
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_X = 39
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_Y = 40
%EQUATE `GLOBALCOUNTER_RECYCLEDIRTYCOUNT_DRIVE_Z = 41
%EQUATE `GLOBALCOUNTER_RECYCLEBINENUM = 44
%EQUATE `GLOBALCOUNTER_RECYCLEBINCORRUPTED = 45
%EQUATE `GLOBALCOUNTER_RATINGS_STATECOUNTER = 46
%EQUATE `GLOBALCOUNTER_PRIVATE_PROFILE_CACHE = 47
%EQUATE `GLOBALCOUNTER_INTERNETTOOLBAR_LAYOUT = 48
%EQUATE `GLOBALCOUNTER_FOLDERDEFINITION_CACHE = 49
%EQUATE `GLOBALCOUNTER_COMMONPLACES_LIST_CACHE = 50
%EQUATE `GLOBALCOUNTER_PRIVATE_PROFILE_CACHE_MACHINEWIDE = 51
%EQUATE `GLOBALCOUNTER_ASSOCCHANGED = 52 ' // throttles reading of the registry value "GlobalAssocChangedCounter" from HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer
%EQUATE `GLOBALCOUNTER_MAXIMUMVALUE = 53 ' // should always be last value
DECLARE FUNCTION SHGlobalCounterGetValue LIB "shell32.dll" ALIAS "SHGlobalCounterGetValue" ( BYVAL id AS LONG ' const SHGLOBALCOUNTER id ) AS LONG ' long
DECLARE FUNCTION SHGlobalCounterIncrement LIB "shell32.dll" ALIAS "SHGlobalCounterIncrement" ( BYVAL id AS LONG ' const SHGLOBALCOUNTER id ) AS LONG ' long
DECLARE FUNCTION SHGlobalCounterDecrement LIB "shell32.dll" ALIAS "SHGlobalCounterDecrement" ( BYVAL id AS LONG ' const SHGLOBALCOUNTER id ) AS LONG ' long
'// Shared memory apis
'#if (_WIN32_IE >= 0x0603)
DECLARE FUNCTION SHAllocShared LIB "shell32.dll" ALIAS "SHAllocShared" ( BYVAL pvData AS QUAD , BYVAL dwSize AS QUAD , BYVAL dwDestinationProcessId AS QUAD ) AS QUAD
'FUNCTION SHAllocShared ( ' BYVAL pvData AS QUAD
' , BYVAL dwSize AS DWORD
' , BYVAL dwDestinationProcessId AS DWORD
' ) AS DWORD
' LOCAL DWRESULT AS DWORD
' LOCAL hLib AS DWORD
' LOCAL pAddr AS DWORD
' hLib = LoadLibrary("SHELL32.DLL")
' IF hLib THEN
' pAddr = GetProcAddress(hLib, BYVAL MAK(DWORD, 520, 0))
' IF pAddr THEN CALL DWORD pAddr USING SHAllocShared(pvData, dwSize, dwDestinationProcessId) TO DWRESULT
' FreeLibrary hLib
' END IF
' FUNCTION = DWRESULT
'END FUNCTION
DECLARE FUNCTION SHFreeShared LIB "shell32.dll" ALIAS "SHFreeShared" ( BYVAL hData AS QUAD , BYVAL dwSourceProcId AS QUAD ) AS LONG
'FUNCTION SHFreeShared ( ' BYVAL hData AS QUAD ' HANDLE hData
' , BYVAL dwSourceProcId AS DWORD ' DWORD dwSourceProcId
' ) AS LONG
' LOCAL LRESULT AS LONG
' LOCAL hLib AS DWORD
' LOCAL pAddr AS DWORD
' hLib = LoadLibrary("SHELL32.DLL")
' IF hLib THEN
' pAddr = GetProcAddress(hLib, BYVAL MAK(DWORD, 523, 0))
' IF pAddr THEN CALL DWORD pAddr USING SHFreeShared(hData, dwSourceProcId) TO LRESULT
' FreeLibrary hLib
' END IF
' FUNCTION = LRESULT
'END FUNCTION
DECLARE FUNCTION SHLockShared LIB "shell32.dll" ALIAS "SHLockShared" ( BYVAL hData AS QUAD , BYVAL dwOtherProcId AS QUAD ) AS QUAD
'FUNCTION SHLockShared ( ' BYVAL hData AS QUAD
' , BYVAL dwOtherProcId AS DWORD
' ) AS DWORD
' LOCAL DWRESULT AS DWORD
' LOCAL hLib AS DWORD
' LOCAL pAddr AS DWORD
' hLib = LoadLibrary("SHELL32.DLL")
' IF hLib THEN
' pAddr = GetProcAddress(hLib, BYVAL MAK(DWORD, 521, 0))
' IF pAddr THEN CALL DWORD pAddr USING SHLockShared(hData, dwOtherProcId) AS DWRESULT
' FreeLibrary hLib
' END IF
' FUNCTION = DWRESULT
'END FUNCTION
DECLARE FUNCTION SHUnlockShared LIB "shell32.dll" ALIAS "SHUnlockShared" ( BYVAL lpvData AS QUAD ) AS LONG
'FUNCTION SHUnlockShared ( ' BYVAL lpvData AS QUAD
' ) AS LONG
' LOCAL LRESULT AS LONG
' LOCAL hLib AS DWORD
' LOCAL pAddr AS DWORD
' hLib = LoadLibrary("SHELL32.DLL")
' IF hLib THEN
' pAddr = GetProcAddress(hLib, BYVAL MAK(DWORD, 522, 0))
' IF pAddr THEN CALL DWORD pAddr USING SHUnlockShared(lpvData) TO LRESULT
' FreeLibrary hLib
' END IF
' FUNCTION = LRESULT
'END FUNCTION
'#endif // _WIN32_IE >= 0x0603
'#if (_WIN32_IE >= _WIN32_IE_IE501)
DECLARE FUNCTION WhichPlatform LIB "shell32.dll" ALIAS "WhichPlatform" ( ) AS QUAD ' UINT
'// Return values of WhichPlatform
%EQUATE `PLATFORM_UNKNOWN = 0
%EQUATE `PLATFORM_IE3 = 1 ' // obsolete: use PLATFORM_BROWSERONLY
%EQUATE `PLATFORM_BROWSERONLY = 1 ' // browser-only (no new shell)
%EQUATE `PLATFORM_INTEGRATED = 2 ' // integrated shell
'//*** QueryInterface helpers
'// NOTES
'// ATL has a fancier version of this. if we need to extend ours, we
'// should probably just switch to ATL's rather than reinvent.
'// EXAMPLE
'// Cfoo::QI(REFIID riid, void **ppv)
'// {
'// // (the IID_xxx comments make grep'ing work!)
'// static const QITAB qit = {
'// QITABENT(Cfoo, Iiface1), // IID_Iiface1
'// ...
'// QITABENT(Cfoo, IifaceN), // IID_IifaceN
'// { 0 }, // n.b. don't forget the 0
'// };
'//
'// // n.b. make sure you don't cast 'this'
'// hr = QISearch(this, qit, riid, ppv);
'// if (FAILED(hr))
'// hr = SUPER::QI(riid, ppv);
'// // custom code could be added here for FAILED() case
'// return hr;
'// }
'//
'// If you have an interface that is implemented multiple times,
'// the compiler will claim an ambiguous cast, so you need to give
'// some help. For example, if your class is defined as
'//
'// class CClass : public IPersistStream, public IPersistFile
'//
'// then you need to say
'//
'// QITABENTMULTI(CClass, IPersist, IPersistStream)
'// QITABENT(CClass, IPersistStream)
'// QITABENT(CClass, IPersistFile)
'//
'// The MULTI is needed for IPersist because the compiler doesn't
'// know whether you wanted the IPersist from IPersistStream
'// or the IPersist from IPersistFile. Unless you have played weird
'// compiler tricks, they are the same implementation, so you can
'// just pick either one, doesn't matter.
'//
'// Common mistake: You do not need to use MULTI if the base interface
'// can be unambiguously determined. E.g.,
'//
'// class CSimple : public IContextMenu3
'//
'// QITABENT(CClass, IContextMenu) // do not need MULTI
'// QITABENT(CClass, IContextMenu2) // do not need MULTI
'// QITABENT(CClass, IContextMenu3)
'//
'// Do not create an entry for IUnknown; the first entry in the
'// table will be used for IUnknown.
'//
' // Size = 8 bytes
TYPE QITAB DWORD
 piid AS GUID PTR ' const IID *
 dwOffset AS LONG ' int
END TYPE
'#ifdef __cplusplus
'#define QITABENTMULTI(Cthis, Ifoo, Iimpl) \
' { &__uuidof(Ifoo), OFFSETOFCLASS(Iimpl, Cthis) }
'#else
'#define QITABENTMULTI(Cthis, Ifoo, Iimpl) \
' { (IID*) &IID_##Ifoo, OFFSETOFCLASS(Iimpl, Cthis) }
'#endif // __cplusplus
'#define QITABENTMULTI2(Cthis, Ifoo, Iimpl) \
' { (IID*) &Ifoo, OFFSETOFCLASS(Iimpl, Cthis) }
'#define QITABENT(Cthis, Ifoo) QITABENTMULTI(Cthis, Ifoo, Ifoo)
DECLARE FUNCTION QISearch LIB "shell32.dll" ALIAS "QISearch" ( BYVAL that AS IUnknown , BYREF pqit AS QITAB , BYREF riid AS GUID , BYREF ppv AS IUnknown ) AS LONG
'#endif // (_WIN32_IE >= _WIN32_IE_IE501)
'#ifndef STATIC_CAST
'//*** STATIC_CAST -- 'portable' static_cast<>
'// NOTES
'// do *not* use SAFE_CAST (see comment in OFFSETOFCLASS)
'#define STATIC_CAST(typ) static_cast<typ>
'#ifndef _X86_
' // assume only intel compiler (>=vc5) supports static_cast for now
' // we could key off of _MSC_VER >= 1100 but i'm not sure that will work
' //
' // a straight cast will give the correct result but no error checking,
' // so we'll have to catch errors on intel.
' #undef STATIC_CAST
' #define STATIC_CAST(typ) (typ)
'#endif
'#endif
'#ifndef OFFSETOFCLASS
'//*** OFFSETOFCLASS -- (stolen from ATL)
'// we use STATIC_CAST not SAFE_CAST because the compiler gets confused
'// (it doesn't constant-fold the ,-op in SAFE_CAST so we end up generating
'// code for the table!)
'#define OFFSETOFCLASS(base, derived) \
' ((DWORD)(DWORD_PTR)(STATIC_CAST(base*)((derived*)8))-8)
'#endif
'// Types for SHIsLowMemoryMachine
%EQUATE `ILMM_IE4 = 0 ' // 1997-era machine
DECLARE FUNCTION SHIsLowMemoryMachine LIB "shell32.dll" ALIAS "SHIsLowMemoryMachine" ( BYVAL dwType AS QUAD ) AS LONG ' DWORD dwType
'// Menu Helpers
DECLARE FUNCTION GetMenuPosFromID LIB "shell32.dll" ALIAS "GetMenuPosFromID" ( BYVAL hmenu AS QUAD , BYVAL id AS QUAD ) AS LONG ' int
DECLARE FUNCTION SHGetInverseCMAP LIB "shell32.dll" ALIAS "SHGetInverseCMAP" ( BYREF pbMap AS BYTE , BYVAL cbMap AS QUAD ) AS LONG
'#if (_WIN32_IE >= 0x0500)
'// SHAutoComplete
'// hwndEdit - HWND of editbox, ComboBox or ComboBoxEx.
'// dwFlags - Flags to indicate what to AutoAppend or AutoSuggest for the editbox.
'//
'// WARNING:
'// Caller needs to have called CoInitialize() or OleInitialize()
'// and cannot call CoUninit/OleUninit until after
'// WM_DESTROY on hwndEdit.
'//
'// dwFlags values:
%EQUATE `SHACF_DEFAULT = &H00000000 ' // Currently (SHACF_FILESYSTEM | SHACF_URLALL)
%EQUATE `SHACF_FILESYSTEM = &H00000001 ' // This includes the File System as well as the rest of the shell (Desktop\My Computer\Control Panel\)
%EQUATE `SHACF_URLHISTORY = &H00000002 ' // URLs in the User's History
%EQUATE `SHACF_URLMRU = &H00000004 ' // URLs in the User's Recently Used list.
%EQUATE `SHACF_USETAB = &H00000008 ' // Use the tab to move thru the autocomplete possibilities instead of to the next dialog/window control.
%EQUATE `SHACF_FILESYS_ONLY = &H00000010 ' // This includes the File System
%EQUATE `SHACF_URLALL = (%SHACF_URLHISTORY OR %SHACF_URLMRU)
'#if (_WIN32_IE >= 0x0600)
%EQUATE `SHACF_FILESYS_DIRS = &H00000020 ' // Same as SHACF_FILESYS_ONLY except it only includes directories, UNC servers, and UNC server shares.
'#endif ' // (_WIN32_IE >= = &H0600)
'#if (_WIN32_IE >= _WIN32_IE_IE70)
%EQUATE `SHACF_VIRTUAL_NAMESPACE = &H00000040 ' // Also include the virtual namespace
'#endif ' // _WIN32_IE_IE70
%EQUATE `SHACF_AUTOSUGGEST_FORCE_ON = &H10000000 ' // Ignore the registry default and force the feature on.
%EQUATE `SHACF_AUTOSUGGEST_FORCE_OFF = &H20000000 ' // Ignore the registry default and force the feature off.
%EQUATE `SHACF_AUTOAPPEND_FORCE_ON = &H40000000 ' // Ignore the registry default and force the feature on. (Also know as AutoComplete)
%EQUATE `SHACF_AUTOAPPEND_FORCE_OFF = &H80000000 ' // Ignore the registry default and force the feature off. (Also know as AutoComplete)
DECLARE FUNCTION SHAutoComplete LIB "shlwapi.dll" ALIAS "SHAutoComplete" ( BYVAL hwndEdit AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
'#if (_WIN32_IE >= _WIN32_IE_IE60SP2)
DECLARE FUNCTION SHCreateThreadRef LIB "shlwapi.dll" ALIAS "SHCreateThreadRef" ( BYREF pcRef AS LONG , BYREF ppunk AS IUnknown ) AS LONG
'#endif // _WIN32_IE_IE60SP2
DECLARE FUNCTION SHSetThreadRef LIB "shlwapi.dll" ALIAS "SHSetThreadRef" ( BYVAL punk AS IUnknown ) AS LONG
DECLARE FUNCTION SHGetThreadRef LIB "shlwapi.dll" ALIAS "SHGetThreadRef" ( BYREF ppunk AS IUnknown
 ) AS LONG
DECLARE FUNCTION SHSkipJunction LIB "shlwapi.dll" ALIAS "SHSkipJunction" ( BYVAL pbc AS DWORD
 , BYREF pclsid AS GUID
 ) AS LONG
'#endif // (_WIN32_IE >= 0x0500)
%EQUATE `CTF_INSIST = &H00000001 ' // SHCreateThread() dwFlags - call pfnThreadProc synchronously if CreateThread() fails
%EQUATE `CTF_THREAD_REF = &H00000002 ' // hold a reference to the creating thread
%EQUATE `CTF_PROCESS_REF = &H00000004 ' // hold a reference to the creating process
%EQUATE `CTF_COINIT_STA = &H00000008 ' // init COM for the created thread
%EQUATE `CTF_COINIT = %CTF_COINIT_STA ' // init COM as STA for the created thread
'#if (_WIN32_IE >= _WIN32_IE_IE60)
%EQUATE `CTF_FREELIBANDEXIT = &H00000010 ' // hold a ref to the DLL and call FreeLibraryAndExitThread() when done
%EQUATE `CTF_REF_COUNTED = &H00000020 ' // thread supports ref counting via SHGetThreadRef() or CTF_THREAD_REF so that child threads can keep this thread alive
%EQUATE `CTF_WAIT_ALLOWCOM = &H00000040 ' // while waiting for pfnCallback, allow COM marshaling to the blocked calling thread
'#endif // _WIN32_IE_IE60
'#if (_WIN32_IE >= _WIN32_IE_IE70)
%EQUATE `CTF_UNUSED = &H00000080
%EQUATE `CTF_INHERITWOW64 = &H00000100 ' // new thread should inherit the wow64 disable state for the file system redirector
'#endif // _WIN32_IE_IE70
'#if (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `CTF_WAIT_NO_REENTRANCY = &H00000200 ' // don't allow re-entrancy when waiting for the sync proc, this won't work with marshalled objects or SendMessages() from the sync proc
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if (NTDDI_VERSION >= NTDDI_WIN7)
%EQUATE `CTF_KEYBOARD_LOCALE = &H00000400 ' // carry the keyboard locale from creating to created thread
%EQUATE `CTF_OLEINITIALIZE = &H00000800 ' // init OLE on the created thread (this will also init COM as STA)
%EQUATE `CTF_COINIT_MTA = &H00001000 ' // init COM as MTA for the created thread
%EQUATE `CTF_NOADDREFLIB = &H00002000 ' // this flag is the opposite of CTF_FREELIBANDEXIT that is now implicit as of Vista
 ' // this avoids the LoadLibrary/FreeLibraryAndExitThread calls that result in contention for the loader lock
 ' // only use this when the thread being created has some other means to ensure that the code
 ' // of the thread proc will remain loaded. This should not be used in the context of COM objects as those
 ' // need to ensure that the DLL stays loaded as COM will unload DLLs
'#endif // (NTDDI_VERSION >= NTDDI_WIN7)
'typedef DWORD SHCT_FLAGS; // SHCreateThread flags values
DECLARE FUNCTION SHCreateThread LIB "shlwapi.dll" ALIAS "SHCreateThread" ( BYVAL pfnThreadProc AS QUAD , BYVAL pData AS QUAD , BYVAL dwFlags AS QUAD , BYVAL pfnCallback AS QUAD ) AS LONG
DECLARE FUNCTION SHCreateThreadWithHandle LIB "shlwapi.dll" ALIAS "SHCreateThreadWithHandle" ( BYVAL pfnThreadProc AS QUAD
 , BYVAL pData AS DWORD
 , BYVAL flags AS DWORD
 , BYVAL pfnCallback AS DWORD
 , BYREF pHandle AS DWORD
 ) AS LONG
'#if (_WIN32_IE >= _WIN32_IE_IE60)
DECLARE FUNCTION SHReleaseThreadRef LIB "shlwapi.dll" ALIAS "SHReleaseThreadRef" ( ) AS LONG
'#endif // _WIN32_IE_IE60
#IF NOT %DEF(%NO_SHLWAPI_GDI)
'//
'//====== GDI helper functions ================================================
'//
DECLARE FUNCTION SHCreateShellPalette LIB "shlwapi.dll" ALIAS "SHCreateShellPalette" ( BYVAL HDC AS QUAD ) AS QUAD ' HPALETTE
'#if (_WIN32_IE >= 0x0500)
DECLARE SUB ColorRGBToHLS LIB "shlwapi.dll" ALIAS "ColorRGBToHLS" ( BYVAL clrRGB AS QUAD , BYREF pwHue AS WORD , BYREF pwLuminance AS WORD , BYREF pwSaturation AS WORD ) ' void
DECLARE FUNCTION ColorHLSToRGB LIB "shlwapi.dll" ALIAS "ColorHLSToRGB" ( BYVAL wHue AS WORD , BYVAL wLuminance AS WORD , BYVAL wSaturation AS WORD ) AS QUAD ' COLORREF
DECLARE FUNCTION ColorAdjustLuma LIB "shlwapi.dll" ALIAS "ColorAdjustLuma" ( BYVAL clrRGB AS QUAD , BYVAL n AS LONG , BYVAL fScale AS LONG ) AS QUAD ' COLORREF
'#endif // _WIN32_IE >= 0x0500
#ENDIF ' // NO_SHLWAPI_GDI
'//
'//====== DllGetVersion =======================================================
'//
' // Size = 20 bytes
TYPE DLLVERSIONINFO DWORD
 cbsize AS DWORD
 dwMajorVersion AS DWORD ' // Major version
 dwMinorVersion AS DWORD ' // Minor version
 dwBuildNumber AS DWORD ' // Build number
 dwPlatformID AS DWORD ' // DLLVER_PLATFORM_*
END TYPE
'// Platform IDs for DLLVERSIONINFO
%EQUATE `DLLVER_PLATFORM_WINDOWS = &H00000001 ' Windows 95
%EQUATE `DLLVER_PLATFORM_NT = &H00000002 ' Windows NT
'#if (_WIN32_IE >= 0x0501)
'typedef struct _DLLVERSIONINFO2
'{
' DLLVERSIONINFO info1;
' DWORD dwFlags; // No flags currently defined
' ULONGLONG ullVersion; // Encoded as:
' // Major 0xFFFF 0000 0000 0000
' // Minor 0x0000 FFFF 0000 0000
' // Build 0x0000 0000 FFFF 0000
' // QFE 0x0000 0000 0000 FFFF
'} DLLVERSIONINFO2;
' // Size = 32 bytes
TYPE DLLVERSIONINFO2 DWORD ' Must be 8 byte aligned
 info1 AS DLLVERSIONINFO
 dwFlags AS DWORD
 uilVersion AS QUAD ' // Encoded as:
 ' // Major 0xFFFF 0000 0000 0000
 ' // Minor 0x0000 FFFF 0000 0000
 ' // Build 0x0000 0000 FFFF 0000
 ' // QFE 0x0000 0000 0000 FFFF
END TYPE
%EQUATE `DLLVER_MAJOR_MASK = &HFFFF000000000000&&
%EQUATE `DLLVER_MINOR_MASK = &H0000FFFF00000000&&
%EQUATE `DLLVER_BUILD_MASK = &H00000000FFFF0000&&
%EQUATE `DLLVER_QFE_MASK = &H000000000000FFFF&&
'#define MAKEDLLVERULL(major, minor, build, qfe) \
' (((ULONGLONG)(major) << 48) | \
' ((ULONGLONG)(minor) << 32) | \
' ((ULONGLONG)(build) << 16) | \
' ((ULONGLONG)( qfe) << 0))
FUNCTION MAKEDLLVERULL (BYVAL major AS QUAD, BYVAL minor AS QUAD, BYVAL build AS QUAD, BYVAL qfe AS QUAD) AS QUAD
 SHIFT LEFT major, 48
 SHIFT LEFT minor, 32
 SHIFT LEFT build, 16
 SHIFT LEFT qfe, 0
 FUNCTION = major OR minor OR build OR qfe
END FUNCTION
'//
'// The caller should always GetProcAddress("DllGetVersion"), not
'// implicitly link to it.
'//
FUNCTION DllGetVersion (BYREF pdvi AS DLLVERSIONINFO) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pAddr AS DWORD
 LOCAL hr AS LONG
 hr = 1
 pdvi.cbSize = SIZEOF(DLLVERSIONINFO)
 hLib = LoadLibrary("SHLWAPI.DLL")
 IF hLib THEN
 pAddr = GetProcAddress(hLib, "DllGetVersion")
 IF pAddr THEN CALL DWORD pAddr USING DllGetVersion(pdvi) TO hr
 FreeLibrary hLib
 END IF
 FUNCTION = hr
END FUNCTION
'typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
'// DllInstall (to be implemented by self-installing DLLs)
DECLARE FUNCTION DllInstall LIB "shlwapi.dll" ALIAS "DllInstall" ( BYVAL bInstall AS LONG , BYREF pszCmdLine AS WSTRINGZ ) AS LONG
'#if (_WIN32_IE >= 0x0602)
'// Function to see if Internet Explorer Enhanced Security Configuration is active for the current user
DECLARE FUNCTION IsInternetESCEnabled LIB "shlwapi.dll" ALIAS "IsInternetESCEnabled" ( ) AS LONG
'#endif // (_WIN32_IE >= 0x0602)
' ========================================================================================
' Converts image file format between GIF/BMP/JPG/PNG.
' Undocumented function. Exported only by ordinal.
' typedef HRESULT (WINAPI*PSHCGF) (IN LPCWSTR pSrcFileName, IN LPCWSTR pDestFileName, IN DWORD dwFlags);
' ========================================================================================
FUNCTION SHConvertGraphicsFile( BYREF wszSrcFileName AS WSTRINGZ, ' Source file name
 BYREF wszDestFileName AS WSTRINGZ, ' Destination file name
 BYVAL dwFlags AS DWORD ' Overwrite file (TRUE/FALSE)
 ) AS LONG
 LOCAL hLib AS DWORD
 LOCAL pProc AS DWORD
 LOCAL hr AS LONG
 hLib = LoadLibrary("shlwapi.dll")
 IF hLib = %NULL THEN
 hr = GetLastError
 ELSE
 pProc = GetProcAddress (hLib, BYVAL MAK(LONG, 488, 0))
 IF pProc = %NULL THEN
 hr = GetLastError
 ELSE
 CALL DWORD pProc USING SHConvertGraphicsFile(wszSrcFileName, wszDestFileName, dwFlags) TO hr
 END IF
 FreeLibrary hLib
 END IF
 FUNCTION = hr
END FUNCTION
' ========================================================================================
#ENDIF ' #IF NOT %DEF(%NOSHLWAPI)
#ENDIF
