' ########################################################################################
' Microsoft Windows
' File: iepmapi.inc
' Contents: Defines the IE Protected Mode 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_iepmapi_PBI)
#DEFINE PBX_iepmapi_PBI
%EQUATE `IEPMAPI_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
'// Remap old API names to new ones.
'#define IEGetWriteableHKCU IEGetWriteableLowHKCU
'// IE Launch Option Flags
' enum IELAUNCHOPTION_FLAGS
%EQUATE `IELAUNCHOPTION_SCRIPTDEBUG = &H00000001
'//+-------------------------------------------------------------------------
'//
'// Structure: IELAUNCHURLINFO
'//
'// Members:
'// cbSize - Size of the structure, in bytes.
'// dwCreationFlags - Process Creation flags used by CreateProcess
'// and CreateProcessAsUser functions.
'//
'//--------------------------------------------------------------------------
' // Size = 12 bytes
TYPE IELAUNCHURLINFO
 cbSize AS DWORD
 dwCreationFlags AS DWORD
 dwLaunchOptionFlags AS DWORD
END TYPE
'//+-------------------------------------------------------------------------
'//
'// Method: IESaveFile
'//
'// Synopsis: Saves the file to the location selected by the user in a
'// previous call to IEShowSaveFileDialog
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IESaveFile LIB "ieframe.dll" ALIAS "IESaveFile" ( BYVAL hState AS QUAD , BYREF lpwstrSourceFile AS WSTRINGZ ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IECancelSaveFile
'//
'// Synopsis: Cancels the save operation and releases the resources
'// allocated for the previous call to IEShowSaveFileDialog
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IECancelSaveFile LIB "ieframe.dll" ALIAS "IECancelSaveFile" ( BYVAL hState AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEShowSaveFileDialog
'//
'// Synopsis: Shows the standard SaveFile dialog from a higher integrity
'// user context
'//
'// Remarks: When no longer needed, call CoTaskMemFree to release
'// lppwstrDestinationFilePath
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEShowSaveFileDialog LIB "ieframe.dll" ALIAS "IEShowSaveFileDialog" ( BYVAL hwnd AS QUAD , BYREF lpwstrInitialFileName AS WSTRINGZ , BYREF lpwstrInitialDir AS WSTRINGZ , BYREF lpwstrFilter AS WSTRINGZ , BYREF lpwstrDefExt AS WSTRINGZ , BYVAL dwFilterIndex AS QUAD , BYVAL dwFlags AS QUAD , BYREF lppwstrDestinationFilePath AS WSTRINGZ , BYREF phState AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEGetWriteableLowHKCU
'//
'// Synopsis: Returns a handle to a write accessible location under
'// HKEY_CURRENT_USER for MIC Low process
'//
'// Remarks: When no longer needed, call RegCloseKey function to close
'// the HKEY
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEGetWriteableLowHKCU LIB "ieframe.dll" ALIAS "IEGetWriteableLowHKCU" ( BYREF pHKey AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEGetWriteableFolderPath
'//
'// Synopsis: Returns the current location of the specified folder.
'// In protected mode, the path points to a location where
'// the user has write permissions
'//
'// Remarks: When no longer needed, call CoTaskMemFree to release the
'// lppwstrPath
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEGetWriteableFolderPath LIB "ieframe.dll" ALIAS "IEGetWriteableFolderPath" ( BYREF clsidFolderID AS GUID , BYREF lppwstrPath AS WSTRINGZ ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEIsProtectedModeProcess
'//
'// Synopsis: Determines if Internet Explorer is running in protected mode
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEIsProtectedModeProcess LIB "ieframe.dll" ALIAS "IEIsProtectedModeProcess" ( BYREF pbResult AS LONG ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEIsProtectedModeURL
'//
'// Synopsis: Determines if the URL runs in Protected Mode or not
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEIsProtectedModeURL LIB "ieframe.dll" ALIAS "IEIsProtectedModeURL" ( BYREF lpwstrUrl AS WSTRINGZ ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IELaunchURL
'//
'// Synopsis: Launches the appropriate IE to handle the navigation to
'// the URL
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IELaunchURL LIB "ieframe.dll" ALIAS "IELaunchURL" ( BYREF lpwstrUrl AS WSTRINGZ , BYREF lpProcInfo AS PROCESS_INFORMATION , BYREF lpInfo AS ANY ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IERefreshElevationPolicy
'//
'// Synopsis: Causes the next elevation policy look up to refresh from
'// the registry
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IERefreshElevationPolicy LIB "ieframe.dll" ALIAS "IERefreshElevationPolicy" ( ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEGetProtectedModeCookie
'//
'// Synopsis: Retrieves the cookie data from the Protected Mode Cookie store
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEGetProtectedModeCookie LIB "ieframe.dll" ALIAS "IEGetProtectedModeCookie" ( BYREF lpszURL AS WSTRINGZ , BYREF lpszCookieName AS WSTRINGZ , BYREF lpszCookieData AS WSTRINGZ , BYREF pcchCookieData AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IESetProtectedModeCookie
'//
'// Synopsis: Set the cookie data in the Protected Mode Cookie store
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IESetProtectedModeCookie LIB "ieframe.dll" ALIAS "IESetProtectedModeCookie" ( BYREF lpszURL AS WSTRINGZ , BYREF lpszCookieName AS WSTRINGZ , BYREF lpszCookieData AS WSTRINGZ , BYVAL dwFlags AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IERegisterWritableRegistryKey
'//
'// Synopsis: Register a subkey path during installation so that
'// low process can write into this location during run time.
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IERegisterWritableRegistryKey LIB "ieframe.dll" ALIAS "IERegisterWritableRegistryKey" ( BYVAL guid AS GUID , BYREF lpSubkey AS WSTRINGZ , BYVAL fSubkeyAllowed AS LONG ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IERegisterWritableRegistryValue
'//
'// Synopsis: Register a value in a subkey path during installation so that
'// low process can write into this location during run time.
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IERegisterWritableRegistryValue LIB "ieframe.dll" ALIAS "IERegisterWritableRegistryValue" ( BYVAL guid AS GUID , BYREF lpPath AS WSTRINGZ , BYREF lpValueName AS WSTRINGZ , BYVAL dwType AS QUAD , BYVAL lpData AS BYTE PTR , BYVAL cbMaxData AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEUnregisterWritableRegistryKey
'//
'// Synopsis: Unregister a registry path during uninstallation so that
'// low process can not write into this location
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEUnregisterWritableRegistry LIB "ieframe.dll" ALIAS "IEUnregisterWritableRegistry" ( BYVAL guid AS GUID ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IERegCreateKeyEx
'//
'// Synopsis: Call Broker to do RegCreateKeyEx on pre-registered locations
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IERegCreateKeyEx LIB "ieframe.dll" ALIAS "IERegCreateKeyEx" ( BYREF lpSubKey AS WSTRINGZ , BYVAL Reserved AS QUAD , BYREF lpClass AS WSTRINGZ , BYVAL dwOptions AS QUAD , BYVAL samDesired AS QUAD , BYREF lpSecurityAttributes AS SECURITY_ATTRIBUTES , BYREF phkResult AS QUAD , BYREF lpdwDisposition AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IERegSetValueEx
'//
'// Synopsis: Call Broker to do RegSetValueEx on pre-registered location
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IERegSetValueEx LIB "ieframe.dll" ALIAS "IERegSetValueEx" ( BYVAL lpSubKey AS QUAD , BYREF lpValueName AS WSTRINGZ , BYVAL Reserved AS QUAD , BYVAL dwType AS QUAD , BYVAL lpData AS BYTE PTR , BYVAL cbData AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IECreateFile
'//
'// Synopsis: wrapper to CreateFile
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IECreateFile LIB "ieframe.dll" ALIAS "IECreateFile" ( BYREF lpFileName AS WSTRINGZ , BYVAL dwDesiredAccess AS QUAD , BYVAL dwShareMode AS QUAD , BYREF lpSecurityAttributes AS SECURITY_ATTRIBUTES , BYVAL dwCreationDisposition AS QUAD , BYVAL dwFlagsAndAttributes AS QUAD , BYVAL hTemplateFile AS QUAD ) AS QUAD
'//+-------------------------------------------------------------------------
'//
'// Method: IEDeleteFile
'//
'// Synopsis: wrapper to DeleteFile
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEDeleteFile LIB "ieframe.dll" ALIAS "IEDeleteFile" ( BYREF lpFileName AS WSTRINGZ ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IERemoveDirectory
'//
'// Synopsis: wrapper to RemoveDirectory
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IERemoveDirectory LIB "ieframe.dll" ALIAS "IERemoveDirectory" ( BYREF lpPathName AS WSTRINGZ ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEMoveFileEx
'//
'// Synopsis: wrapper to MoveFileEx
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEMoveFileEx LIB "ieframe.dll" ALIAS "IEMoveFileEx" ( BYREF lpExistingFileName AS WSTRINGZ , BYREF lpNewFileName AS WSTRINGZ , BYVAL dwFlags AS QUAD ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IECreateDirectory
'//
'// Synopsis: wrapper to CreateDirectory
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IECreateDirectory LIB "ieframe.dll" ALIAS "IECreateDirectory" ( BYREF lpPathName AS WSTRINGZ , BYREF lpSecurityAttributes AS SECURITY_ATTRIBUTES ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEGetFileAttributesEx
'//
'// Synopsis: wrapper to GetFileAttributesEx
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEGetFileAttributesEx LIB "ieframe.dll" ALIAS "IEGetFileAttributesEx" ( BYREF lpFileName AS WSTRINGZ , BYVAL fInfoLevelId AS LONG , BYREF lpFileInformation AS ANY ) AS LONG
'//+-------------------------------------------------------------------------
'//
'// Method: IEFindFirstFile
'//
'// Synopsis: wrapper to FindFirstFile
'//
'//--------------------------------------------------------------------------
DECLARE FUNCTION IEFindFirstFile LIB "ieframe.dll" ALIAS "IEFindFirstFile" ( BYREF lpFileName AS WSTRINGZ , BYREF lpFindFileData AS WIN32_FIND_DATAW ) AS QUAD
#ENDIF
