1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #ifndef _NTDSBCLI_H_ 7 #define _NTDSBCLI_H_ 8 9 #include <_mingw_unicode.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 #define xRPC_STRING 16 17 #ifndef __WCHAR_DEFINED 18 #define __WCHAR_DEFINED 19 typedef unsigned short WCHAR; 20 #endif 21 22 #ifndef _NTDSBCLI_DEFINED 23 #define NTDSBCLI_API __declspec(dllimport) _stdcall 24 #else 25 #define NTDSBCLI_API 26 #endif 27 28 #ifndef _HRESULT_DEFINED 29 #define _HRESULT_DEFINED 30 typedef LONG HRESULT; 31 #endif 32 33 #define g_wszBackupAnnotation L"NTDS Backup Interface" 34 #define g_aszBackupAnnotation "NTDS Backup Interface" 35 36 #define g_wszRestoreAnnotation L"NTDS Restore Interface" 37 #define g_aszRestoreAnnotation "NTDS Restore Interface" 38 39 #if defined(UNICODE) 40 #define g_szBackupAnnotation g_wszBackupAnnotation 41 #define g_szRestoreAnnotation g_wszRestoreAnnotation 42 #else 43 #define g_szBackupAnnotation g_aszBackupAnnotation 44 #define g_szRestoreAnnotation g_aszRestoreAnnotation 45 #endif 46 47 #define BACKUP_TYPE_FULL 0x01 48 #define BACKUP_TYPE_LOGS_ONLY 0x02 49 #define BACKUP_TYPE_INCREMENTAL 0x04 50 51 #define RESTORE_TYPE_AUTHORATATIVE 0x01 52 #define RESTORE_TYPE_ONLINE 0x02 53 #define RESTORE_TYPE_CATCHUP 0x04 54 55 #define BACKUP_DISABLE_INCREMENTAL 0xffffffff 56 57 #if defined(UNICODE) 58 typedef WCHAR BFT; 59 #else 60 typedef CHAR BFT; 61 #endif 62 63 #define BFT_DIRECTORY 0x80 64 #define BFT_DATABASE_DIRECTORY 0x40 65 #define BFT_LOG_DIRECTORY 0x20 66 67 #define BFT_LOG (BFT)(TEXT('\x01') | BFT_LOG_DIRECTORY) 68 #define BFT_LOG_DIR (BFT)(TEXT('\x02') | BFT_DIRECTORY) 69 #define BFT_CHECKPOINT_DIR (BFT)(TEXT('\x03') | BFT_DIRECTORY) 70 #define BFT_NTDS_DATABASE (BFT)(TEXT('\x04') | BFT_DATABASE_DIRECTORY) 71 #define BFT_PATCH_FILE (BFT)(TEXT('\x05') | BFT_LOG_DIRECTORY) 72 #define BFT_UNKNOWN (BFT)(TEXT('\x0f')) 73 74 #include <ntdsbmsg.h> 75 76 typedef void *HBC; 77 78 typedef struct tagEDB_RSTMAPA { 79 char *szDatabaseName; 80 char *szNewDatabaseName; 81 } EDB_RSTMAPA,*PEDB_RSTMAPA; 82 83 #define UNICODE_RSTMAP 84 85 typedef struct tagEDB_RSTMAPW { 86 WCHAR *wszDatabaseName; 87 WCHAR *wszNewDatabaseName; 88 } EDB_RSTMAPW,*PEDB_RSTMAPW; 89 90 #define EDB_RSTMAP __MINGW_NAME_AW(EDB_RSTMAP) 91 #define PEDB_RSTMAP __MINGW_NAME_AW(PEDB_RSTMAP) 92 93 #define DsIsNTDSOnline __MINGW_NAME_AW(DsIsNTDSOnline) 94 #define DsBackupPrepare __MINGW_NAME_AW(DsBackupPrepare) 95 #define DsBackupGetDatabaseNames __MINGW_NAME_AW(DsBackupGetDatabaseNames) 96 #define DsBackupOpenFile __MINGW_NAME_AW(DsBackupOpenFile) 97 #define DsBackupGetBackupLogs __MINGW_NAME_AW(DsBackupGetBackupLogs) 98 #define DsRestoreGetDatabaseLocations __MINGW_NAME_AW(DsRestoreGetDatabaseLocations) 99 #define DsRestorePrepare __MINGW_NAME_AW(DsRestorePrepare) 100 #define DsRestoreRegister __MINGW_NAME_AW(DsRestoreRegister) 101 #define DsSetCurrentBackupLog __MINGW_NAME_AW(DsSetCurrentBackupLog) 102 #define DsSetAuthIdentity __MINGW_NAME_AW(DsSetAuthIdentity) 103 104 HRESULT NTDSBCLI_API DsIsNTDSOnlineA(LPCSTR szServerName,WINBOOL *pfNTDSOnline); 105 HRESULT NTDSBCLI_API DsIsNTDSOnlineW(LPCWSTR szServerName,WINBOOL *pfNTDSOnline); 106 HRESULT NTDSBCLI_API DsBackupPrepareA(LPCSTR szBackupServer,ULONG grbit,ULONG btFlag,PVOID *ppvExpiryToken,LPDWORD pcbExpiryTokenSize,HBC *phbc); 107 HRESULT NTDSBCLI_API DsBackupPrepareW(LPCWSTR szBackupServer,ULONG grbit,ULONG btFlag,PVOID *ppvExpiryToken,LPDWORD pcbExpiryTokenSize,HBC *phbc); 108 HRESULT NTDSBCLI_API DsBackupGetDatabaseNamesA(HBC hbc,LPSTR *pszAttachmentInfo,LPDWORD pcbSize); 109 HRESULT NTDSBCLI_API DsBackupGetDatabaseNamesW(HBC hbc,LPWSTR *pszAttachmentInfo,LPDWORD pcbSize); 110 HRESULT NTDSBCLI_API DsBackupOpenFileA(HBC hbc,LPCSTR szAttachmentName,DWORD cbReadHintSize,LARGE_INTEGER *pliFileSize); 111 HRESULT NTDSBCLI_API DsBackupOpenFileW(HBC hbc,LPCWSTR szAttachmentName,DWORD cbReadHintSize,LARGE_INTEGER *pliFileSize); 112 HRESULT NTDSBCLI_API DsBackupRead(HBC hbc,PVOID pvBuffer,DWORD cbBuffer,PDWORD pcbRead); 113 HRESULT NTDSBCLI_API DsBackupClose(HBC hbc); 114 HRESULT NTDSBCLI_API DsBackupGetBackupLogsA(HBC hbc,LPSTR *pszBackupLogFiles,LPDWORD pcbSize); 115 HRESULT NTDSBCLI_API DsBackupGetBackupLogsW(HBC hbc,LPWSTR *pszBackupLogFiles,LPDWORD pcbSize); 116 HRESULT NTDSBCLI_API DsBackupTruncateLogs(HBC hbc); 117 HRESULT NTDSBCLI_API DsBackupEnd(HBC hbc); 118 VOID NTDSBCLI_API DsBackupFree(PVOID pvBuffer); 119 HRESULT NTDSBCLI_API DsRestoreGetDatabaseLocationsA(HBC hbc,LPSTR *pszDatabaseLocationList,LPDWORD pcbSize); 120 HRESULT NTDSBCLI_API DsRestoreGetDatabaseLocationsW(HBC hbc,LPWSTR *pszDatabaseLocationList,LPDWORD pcbSize); 121 HRESULT NTDSBCLI_API DsRestorePrepareA(LPCSTR szServerName,ULONG rtFlag,PVOID pvExpiryToken,DWORD cbExpiryTokenSize,HBC *phbc); 122 HRESULT NTDSBCLI_API DsRestorePrepareW(LPCWSTR szServerName,ULONG rtFlag,PVOID pvExpiryToken,DWORD cbExpiryTokenSize,HBC *phbc); 123 HRESULT NTDSBCLI_API DsRestoreRegisterA(HBC hbc,LPCSTR szCheckPointFilePath,LPCSTR szLogPath,EDB_RSTMAPA rgrstmap[],LONG crstmap,LPCSTR szBackupLogPath,ULONG genLow,ULONG genHigh); 124 HRESULT NTDSBCLI_API DsRestoreRegisterW(HBC hbc,LPCWSTR szCheckPointFilePath,LPCWSTR szLogPath,EDB_RSTMAPW rgrstmap[],LONG crstmap,LPCWSTR szBackupLogPath,ULONG genLow,ULONG genHigh); 125 HRESULT NTDSBCLI_API DsRestoreRegisterComplete(HBC hbc,HRESULT hrRestoreState); 126 HRESULT NTDSBCLI_API DsRestoreEnd(HBC hbc); 127 HRESULT NTDSBCLI_API DsSetCurrentBackupLogA(LPCSTR szServerName,DWORD dwCurrentLog); 128 HRESULT NTDSBCLI_API DsSetCurrentBackupLogW(LPCWSTR szServerName,DWORD dwCurrentLog); 129 HRESULT NTDSBCLI_API DsSetAuthIdentityA(LPCSTR szUserName,LPCSTR szDomainName,LPCSTR szPassword); 130 HRESULT NTDSBCLI_API DsSetAuthIdentityW(LPCWSTR szUserName,LPCWSTR szDomainName,LPCWSTR szPassword); 131 132 #ifdef __cplusplus 133 } 134 #endif 135 #endif 136