' ########################################################################################
' Microsoft Windows
' File: SRRestorePtAPI.inc
' Contents: This file contains the declarations for the SRRESTOREPT_API
' 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_SrRestorePtApi_PBI)
#DEFINE PBX_SrRestorePtApi_PBI
%EQUATE `SRRESTOREPTAPI_INC = 1
'//
'// Type of Event
'//
%EQUATE `MIN_EVENT = 100
%EQUATE `BEGIN_SYSTEM_CHANGE = 100
%EQUATE `END_SYSTEM_CHANGE = 101
%EQUATE `BEGIN_NESTED_SYSTEM_CHANGE = 102 ' // for Whistler only - use this to prevent nested restore pts
%EQUATE `END_NESTED_SYSTEM_CHANGE = 103 ' // for Whistler only - use this to prevent nested restore pts
%EQUATE `BEGIN_NESTED_SYSTEM_CHANGE_NORP = 104
%EQUATE `END_NESTED_SYSTEM_CHANGE_NORP = %END_NESTED_SYSTEM_CHANGE
%EQUATE `MAX_EVENT = 104
'//
'// Type of Restore Points
'//
%EQUATE `MIN_RPT = 0
%EQUATE `APPLICATION_INSTALL = 0
%EQUATE `APPLICATION_UNINSTALL = 1
%EQUATE `DESKTOP_SETTING = 2 ' /* Not implemented */
%EQUATE `ACCESSIBILITY_SETTING = 3 ' /* Not implemented */
%EQUATE `OE_SETTING = 4 ' /* Not implemented */
%EQUATE `APPLICATION_RUN = 5 ' /* Not implemented */
%EQUATE `RESTORE = 6
%EQUATE `CHECKPOINT = 7
%EQUATE `WINDOWS_SHUTDOWN = 8 ' /* Not implemented */
%EQUATE `WINDOWS_BOOT = 9 ' /* Not implemented */
%EQUATE `DEVICE_DRIVER_INSTALL = 10
%EQUATE `FIRSTRUN = 11
%EQUATE `MODIFY_SETTINGS = 12
%EQUATE `CANCELLED_OPERATION = 13 ' /* Only valid for END_SYSTEM_CHANGE */
%EQUATE `BACKUP_RECOVERY = 14
%EQUATE `BACKUP = 15
%EQUATE `MANUAL_CHECKPOINT = 16
%EQUATE `WINDOWS_UPDATE = 17
%EQUATE `CRITICAL_UPDATE = 18
%EQUATE `MAX_RPT = 18
%EQUATE `MAX_DESC = 64
%EQUATE `MAX_DESC_W = 256 ' // longer for Whistler
'//
'// for Millennium compatibility
'//
'#pragma pack(push, srrestoreptapi_include)
'#pragma pack(1)
'//
'// Restore point information
'//
' // Size = 80 bytes
TYPE RESTOREPOINTINFOA BYTE
 dwEventType AS DWORD ' DWORD // Type of Event - Begin or End
 dwRestorePtType AS DWORD ' DWORD // Type of Restore Point - App install/uninstall
 llSequenceNumber AS QUAD ' INT64 // Sequence Number - 0 for begin
 szDescription AS ASCIIZ * %MAX_DESC ' CHAR // Description - Name of Application / Operation
END TYPE
' // Size = 528 bytes
TYPE RESTOREPOINTINFOW BYTE
 dwEventType AS DWORD ' DWORD // Type of Event - Begin or End
 dwRestorePtType AS DWORD ' DWORD // Type of Restore Point - App install/uninstall
 llSequenceNumber AS QUAD ' INT64 // Sequence Number - 0 for begin
 szDescription AS WSTRINGZ * %MAX_DESC_W ' WCHAR // Description - Name of Application / Operation
END TYPE
MACRO RESTOREPOINTINFO = RESTOREPOINTINFOA
'//
'// Status returned by System Restore
'//
' // Size = 12 bytes
TYPE STATEMGRSTATUS BYTE
 nStatus AS DWORD ' DWORD // Status returned by State Manager Process
 llSequenceNumber AS QUAD ' INT64 // Sequence Number for the restore point
END TYPE
'#pragma pack(pop, srrestoreptapi_include)
'//
'// RPC call to set a restore point
'//
'// Return value TRUE if the call was a success
'// FALSE if the call failed
'//
'// If pSmgrStatus nStatus field is set as follows
'//
'// ERROR_SUCCESS If the call succeeded (return value will be TRUE)
'//
'// ERROR_TIMEOUT If the call timed out due to a wait on a mutex for
'// for setting restore points.
'//
'// ERROR_INVALID_DATA If the cancel restore point is called with an invalid
'// sequence number
'//
'// ERROR_INTERNAL_ERROR If there are internal failures.
'//
'// ERROR_BAD_ENVIRONMENT If the API is called in SafeMode
'//
'// ERROR_SERVICE_DISABLED If SystemRestore is Disabled.
'//
'// ERROR_DISK_FULL If System Restore is frozen (Windows Whistler only)
'//
'// ERROR_ALREADY_EXISTS If this is a nested restore point
DECLARE FUNCTION SRSetRestorePointA LIB "srclient.dll" ALIAS "SRSetRestorePointA" ( BYREF pRestorePtSpec AS RESTOREPOINTINFOA , BYREF pSMgrStatus AS STATEMGRSTATUS ) AS LONG
DECLARE FUNCTION SRSetRestorePointW LIB "srclient.dll" ALIAS "SRSetRestorePointW" ( BYREF pRestorePtSpec AS RESTOREPOINTINFOW
 , BYREF pSMgrStatus AS STATEMGRSTATUS
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SRSetRestorePoint = SRSetRestorePointW
#ELSE
 MACRO SRSetRestorePoint = SRSetRestorePointA
#ENDIF
DECLARE FUNCTION SRRemoveRestorePoint LIB "srclient.dll" ALIAS "SRRemoveRestorePoint" ( BYVAL dwRPNum AS QUAD ) AS QUAD
#ENDIF
