aboutsummaryrefslogtreecommitdiff
path: root/src/dutil/inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dutil/inc')
-rw-r--r--src/dutil/inc/aclutil.h154
-rw-r--r--src/dutil/inc/apputil.h45
-rw-r--r--src/dutil/inc/apuputil.h86
-rw-r--r--src/dutil/inc/atomutil.h146
-rw-r--r--src/dutil/inc/buffutil.h80
-rw-r--r--src/dutil/inc/butil.h31
-rw-r--r--src/dutil/inc/cabcutil.h62
-rw-r--r--src/dutil/inc/cabutil.h56
-rw-r--r--src/dutil/inc/certutil.h66
-rw-r--r--src/dutil/inc/condutil.h19
-rw-r--r--src/dutil/inc/conutil.h78
-rw-r--r--src/dutil/inc/cryputil.h103
-rw-r--r--src/dutil/inc/dictutil.h69
-rw-r--r--src/dutil/inc/dirutil.h54
-rw-r--r--src/dutil/inc/dlutil.h59
-rw-r--r--src/dutil/inc/dutil.h160
-rw-r--r--src/dutil/inc/eseutil.h223
-rw-r--r--src/dutil/inc/fileutil.h235
-rw-r--r--src/dutil/inc/gdiputil.h38
-rw-r--r--src/dutil/inc/guidutil.h21
-rw-r--r--src/dutil/inc/iis7util.h222
-rw-r--r--src/dutil/inc/inetutil.h39
-rw-r--r--src/dutil/inc/iniutil.h79
-rw-r--r--src/dutil/inc/jsonutil.h112
-rw-r--r--src/dutil/inc/locutil.h120
-rw-r--r--src/dutil/inc/logutil.h190
-rw-r--r--src/dutil/inc/memutil.h80
-rw-r--r--src/dutil/inc/metautil.h52
-rw-r--r--src/dutil/inc/monutil.h108
-rw-r--r--src/dutil/inc/osutil.h39
-rw-r--r--src/dutil/inc/pathutil.h232
-rw-r--r--src/dutil/inc/perfutil.h24
-rw-r--r--src/dutil/inc/polcutil.h39
-rw-r--r--src/dutil/inc/procutil.h75
-rw-r--r--src/dutil/inc/regutil.h233
-rw-r--r--src/dutil/inc/resrutil.h43
-rw-r--r--src/dutil/inc/reswutil.h31
-rw-r--r--src/dutil/inc/rexutil.h54
-rw-r--r--src/dutil/inc/rmutil.h46
-rw-r--r--src/dutil/inc/rssutil.h89
-rw-r--r--src/dutil/inc/sceutil.h273
-rw-r--r--src/dutil/inc/sczutil.h30
-rw-r--r--src/dutil/inc/shelutil.h47
-rw-r--r--src/dutil/inc/sqlutil.h136
-rw-r--r--src/dutil/inc/srputil.h45
-rw-r--r--src/dutil/inc/strutil.h311
-rw-r--r--src/dutil/inc/svcutil.h21
-rw-r--r--src/dutil/inc/thmutil.h711
-rw-r--r--src/dutil/inc/timeutil.h38
-rw-r--r--src/dutil/inc/uncutil.h20
-rw-r--r--src/dutil/inc/uriutil.h100
-rw-r--r--src/dutil/inc/userutil.h32
-rw-r--r--src/dutil/inc/varutil.h126
-rw-r--r--src/dutil/inc/wiutil.h373
-rw-r--r--src/dutil/inc/wuautil.h19
-rw-r--r--src/dutil/inc/xmlutil.h167
56 files changed, 6141 insertions, 0 deletions
diff --git a/src/dutil/inc/aclutil.h b/src/dutil/inc/aclutil.h
new file mode 100644
index 00000000..144e4613
--- /dev/null
+++ b/src/dutil/inc/aclutil.h
@@ -0,0 +1,154 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <aclapi.h>
6#include <sddl.h>
7
8#define ReleaseSid(x) if (x) { AclFreeSid(x); }
9#define ReleaseNullSid(x) if (x) { AclFreeSid(x); x = NULL; }
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15// structs
16struct ACL_ACCESS
17{
18 BOOL fDenyAccess;
19 DWORD dwAccessMask;
20
21 // TODO: consider using a union
22 LPCWSTR pwzAccountName; // NOTE: the last three items in this structure are ignored if this is not NULL
23
24 SID_IDENTIFIER_AUTHORITY sia; // used if pwzAccountName is NULL
25 BYTE nSubAuthorityCount;
26 DWORD nSubAuthority[8];
27};
28
29struct ACL_ACE
30{
31 DWORD dwFlags;
32 DWORD dwMask;
33 PSID psid;
34};
35
36
37// functions
38HRESULT DAPI AclCheckAccess(
39 __in HANDLE hToken,
40 __in ACL_ACCESS* paa
41 );
42HRESULT DAPI AclCheckAdministratorAccess(
43 __in HANDLE hToken
44 );
45HRESULT DAPI AclCheckLocalSystemAccess(
46 __in HANDLE hToken
47 );
48
49HRESULT DAPI AclGetWellKnownSid(
50 __in WELL_KNOWN_SID_TYPE wkst,
51 __deref_out PSID* ppsid
52 );
53HRESULT DAPI AclGetAccountSid(
54 __in_opt LPCWSTR wzSystem,
55 __in_z LPCWSTR wzAccount,
56 __deref_out PSID* ppsid
57 );
58HRESULT DAPI AclGetAccountSidString(
59 __in_z LPCWSTR wzSystem,
60 __in_z LPCWSTR wzAccount,
61 __deref_out_z LPWSTR* ppwzSid
62 );
63
64HRESULT DAPI AclCreateDacl(
65 __in_ecount(cDeny) ACL_ACE rgaaDeny[],
66 __in DWORD cDeny,
67 __in_ecount(cAllow) ACL_ACE rgaaAllow[],
68 __in DWORD cAllow,
69 __deref_out ACL** ppAcl
70 );
71HRESULT DAPI AclAddToDacl(
72 __in ACL* pAcl,
73 __in_ecount_opt(cDeny) const ACL_ACE rgaaDeny[],
74 __in DWORD cDeny,
75 __in_ecount_opt(cAllow) const ACL_ACE rgaaAllow[],
76 __in DWORD cAllow,
77 __deref_out ACL** ppAclNew
78 );
79HRESULT DAPI AclMergeDacls(
80 __in const ACL* pAcl1,
81 __in const ACL* pAcl2,
82 __deref_out ACL** ppAclNew
83 );
84HRESULT DAPI AclCreateDaclOld(
85 __in_ecount(cAclAccesses) ACL_ACCESS* paa,
86 __in DWORD cAclAccesses,
87 __deref_out ACL** ppAcl
88 );
89HRESULT DAPI AclCreateSecurityDescriptor(
90 __in_ecount(cAclAccesses) ACL_ACCESS* paa,
91 __in DWORD cAclAccesses,
92 __deref_out SECURITY_DESCRIPTOR** ppsd
93 );
94HRESULT DAPI AclCreateSecurityDescriptorFromDacl(
95 __in ACL* pACL,
96 __deref_out SECURITY_DESCRIPTOR** ppsd
97 );
98HRESULT __cdecl AclCreateSecurityDescriptorFromString(
99 __deref_out SECURITY_DESCRIPTOR** ppsd,
100 __in_z __format_string LPCWSTR wzSddlFormat,
101 ...
102 );
103HRESULT DAPI AclDuplicateSecurityDescriptor(
104 __in SECURITY_DESCRIPTOR* psd,
105 __deref_out SECURITY_DESCRIPTOR** ppsd
106 );
107HRESULT DAPI AclGetSecurityDescriptor(
108 __in_z LPCWSTR wzObject,
109 __in SE_OBJECT_TYPE sot,
110 __in SECURITY_INFORMATION securityInformation,
111 __deref_out SECURITY_DESCRIPTOR** ppsd
112 );
113HRESULT DAPI AclSetSecurityWithRetry(
114 __in_z LPCWSTR wzObject,
115 __in SE_OBJECT_TYPE sot,
116 __in SECURITY_INFORMATION securityInformation,
117 __in_opt PSID psidOwner,
118 __in_opt PSID psidGroup,
119 __in_opt PACL pDacl,
120 __in_opt PACL pSacl,
121 __in DWORD cRetry,
122 __in DWORD dwWaitMilliseconds
123 );
124
125HRESULT DAPI AclFreeSid(
126 __in PSID psid
127 );
128HRESULT DAPI AclFreeDacl(
129 __in ACL* pACL
130 );
131HRESULT DAPI AclFreeSecurityDescriptor(
132 __in SECURITY_DESCRIPTOR* psd
133 );
134
135HRESULT DAPI AclAddAdminToSecurityDescriptor(
136 __in SECURITY_DESCRIPTOR* pSecurity,
137 __deref_out SECURITY_DESCRIPTOR** ppSecurityNew
138 );
139
140// Following code in acl2util.cpp due to dependency on crypt32.dll.
141HRESULT DAPI AclCalculateServiceSidString(
142 __in LPCWSTR wzServiceName,
143 __in int cchServiceName,
144 __deref_out_z LPWSTR* psczSid
145 );
146HRESULT DAPI AclGetAccountSidStringEx(
147 __in_z LPCWSTR wzSystem,
148 __in_z LPCWSTR wzAccount,
149 __deref_out_z LPWSTR* psczSid
150 );
151
152#ifdef __cplusplus
153}
154#endif
diff --git a/src/dutil/inc/apputil.h b/src/dutil/inc/apputil.h
new file mode 100644
index 00000000..1a1e14f7
--- /dev/null
+++ b/src/dutil/inc/apputil.h
@@ -0,0 +1,45 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9// functions
10
11/********************************************************************
12AppFreeCommandLineArgs - frees argv from AppParseCommandLine.
13
14********************************************************************/
15void DAPI AppFreeCommandLineArgs(
16 __in LPWSTR* argv
17 );
18
19void DAPI AppInitialize(
20 __in_ecount(cSafelyLoadSystemDlls) LPCWSTR rgsczSafelyLoadSystemDlls[],
21 __in DWORD cSafelyLoadSystemDlls
22 );
23
24/********************************************************************
25AppInitializeUnsafe - initializes without the full standard safety
26 precautions for an application.
27
28********************************************************************/
29void DAPI AppInitializeUnsafe();
30
31/********************************************************************
32AppParseCommandLine - parses the command line using CommandLineToArgvW.
33 The caller must free the value of pArgv on success
34 by calling AppFreeCommandLineArgs.
35
36********************************************************************/
37DAPI_(HRESULT) AppParseCommandLine(
38 __in LPCWSTR wzCommandLine,
39 __in int* argc,
40 __in LPWSTR** pArgv
41 );
42
43#ifdef __cplusplus
44}
45#endif
diff --git a/src/dutil/inc/apuputil.h b/src/dutil/inc/apuputil.h
new file mode 100644
index 00000000..6764bde8
--- /dev/null
+++ b/src/dutil/inc/apuputil.h
@@ -0,0 +1,86 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseApupChain(p) if (p) { ApupFreeChain(p); p = NULL; }
10#define ReleaseNullApupChain(p) if (p) { ApupFreeChain(p); p = NULL; }
11
12
13const LPCWSTR APPLICATION_SYNDICATION_NAMESPACE = L"http://appsyndication.org/2006/appsyn";
14
15typedef enum APUP_HASH_ALGORITHM
16{
17 APUP_HASH_ALGORITHM_UNKNOWN,
18 APUP_HASH_ALGORITHM_MD5,
19 APUP_HASH_ALGORITHM_SHA1,
20 APUP_HASH_ALGORITHM_SHA256,
21} APUP_HASH_ALGORITHM;
22
23
24struct APPLICATION_UPDATE_ENCLOSURE
25{
26 LPWSTR wzUrl;
27 LPWSTR wzLocalName;
28 DWORD64 dw64Size;
29
30 BYTE* rgbDigest;
31 DWORD cbDigest;
32 APUP_HASH_ALGORITHM digestAlgorithm;
33
34 BOOL fInstaller;
35};
36
37
38struct APPLICATION_UPDATE_ENTRY
39{
40 LPWSTR wzApplicationId;
41 LPWSTR wzApplicationType;
42 LPWSTR wzTitle;
43 LPWSTR wzSummary;
44 LPWSTR wzContentType;
45 LPWSTR wzContent;
46
47 LPWSTR wzUpgradeId;
48 BOOL fUpgradeExclusive;
49 DWORD64 dw64Version;
50 DWORD64 dw64UpgradeVersion;
51
52 DWORD64 dw64TotalSize;
53
54 DWORD cEnclosures;
55 APPLICATION_UPDATE_ENCLOSURE* rgEnclosures;
56};
57
58
59struct APPLICATION_UPDATE_CHAIN
60{
61 LPWSTR wzDefaultApplicationId;
62 LPWSTR wzDefaultApplicationType;
63
64 DWORD cEntries;
65 APPLICATION_UPDATE_ENTRY* rgEntries;
66};
67
68
69HRESULT DAPI ApupAllocChainFromAtom(
70 __in ATOM_FEED* pFeed,
71 __out APPLICATION_UPDATE_CHAIN** ppChain
72 );
73
74HRESULT DAPI ApupFilterChain(
75 __in APPLICATION_UPDATE_CHAIN* pChain,
76 __in DWORD64 dw64Version,
77 __out APPLICATION_UPDATE_CHAIN** ppFilteredChain
78 );
79
80void DAPI ApupFreeChain(
81 __in APPLICATION_UPDATE_CHAIN* pChain
82 );
83
84#ifdef __cplusplus
85}
86#endif
diff --git a/src/dutil/inc/atomutil.h b/src/dutil/inc/atomutil.h
new file mode 100644
index 00000000..ff869c4a
--- /dev/null
+++ b/src/dutil/inc/atomutil.h
@@ -0,0 +1,146 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseAtomFeed(p) if (p) { AtomFreeFeed(p); }
10#define ReleaseNullAtomFeed(p) if (p) { AtomFreeFeed(p); p = NULL; }
11
12
13struct ATOM_UNKNOWN_ATTRIBUTE
14{
15 LPWSTR wzNamespace;
16 LPWSTR wzAttribute;
17 LPWSTR wzValue;
18
19 ATOM_UNKNOWN_ATTRIBUTE* pNext;
20};
21
22struct ATOM_UNKNOWN_ELEMENT
23{
24 LPWSTR wzNamespace;
25 LPWSTR wzElement;
26 LPWSTR wzValue;
27
28 ATOM_UNKNOWN_ATTRIBUTE* pAttributes;
29 ATOM_UNKNOWN_ELEMENT* pNext;
30};
31
32struct ATOM_LINK
33{
34 LPWSTR wzRel;
35 LPWSTR wzTitle;
36 LPWSTR wzType;
37 LPWSTR wzUrl;
38 LPWSTR wzValue;
39 DWORD64 dw64Length;
40
41 ATOM_UNKNOWN_ATTRIBUTE* pUnknownAttributes;
42 ATOM_UNKNOWN_ELEMENT* pUnknownElements;
43};
44
45struct ATOM_CONTENT
46{
47 LPWSTR wzType;
48 LPWSTR wzUrl;
49 LPWSTR wzValue;
50
51 ATOM_UNKNOWN_ELEMENT* pUnknownElements;
52};
53
54struct ATOM_AUTHOR
55{
56 LPWSTR wzName;
57 LPWSTR wzEmail;
58 LPWSTR wzUrl;
59};
60
61struct ATOM_CATEGORY
62{
63 LPWSTR wzLabel;
64 LPWSTR wzScheme;
65 LPWSTR wzTerm;
66
67 ATOM_UNKNOWN_ELEMENT* pUnknownElements;
68};
69
70struct ATOM_ENTRY
71{
72 LPWSTR wzId;
73 LPWSTR wzSummary;
74 LPWSTR wzTitle;
75 FILETIME ftPublished;
76 FILETIME ftUpdated;
77
78 ATOM_CONTENT* pContent;
79
80 DWORD cAuthors;
81 ATOM_AUTHOR* rgAuthors;
82
83 DWORD cCategories;
84 ATOM_CATEGORY* rgCategories;
85
86 DWORD cLinks;
87 ATOM_LINK* rgLinks;
88
89 IXMLDOMNode* pixn;
90 ATOM_UNKNOWN_ELEMENT* pUnknownElements;
91};
92
93struct ATOM_FEED
94{
95 LPWSTR wzGenerator;
96 LPWSTR wzIcon;
97 LPWSTR wzId;
98 LPWSTR wzLogo;
99 LPWSTR wzSubtitle;
100 LPWSTR wzTitle;
101 FILETIME ftUpdated;
102
103 DWORD cAuthors;
104 ATOM_AUTHOR* rgAuthors;
105
106 DWORD cCategories;
107 ATOM_CATEGORY* rgCategories;
108
109 DWORD cEntries;
110 ATOM_ENTRY* rgEntries;
111
112 DWORD cLinks;
113 ATOM_LINK* rgLinks;
114
115 IXMLDOMNode* pixn;
116 ATOM_UNKNOWN_ELEMENT* pUnknownElements;
117};
118
119HRESULT DAPI AtomInitialize(
120 );
121
122void DAPI AtomUninitialize(
123 );
124
125HRESULT DAPI AtomParseFromString(
126 __in_z LPCWSTR wzAtomString,
127 __out ATOM_FEED **ppFeed
128 );
129
130HRESULT DAPI AtomParseFromFile(
131 __in_z LPCWSTR wzAtomFile,
132 __out ATOM_FEED **ppFeed
133 );
134
135HRESULT DAPI AtomParseFromDocument(
136 __in IXMLDOMDocument* pixdDocument,
137 __out ATOM_FEED **ppFeed
138 );
139
140void DAPI AtomFreeFeed(
141 __in_xcount(pFeed->cItems) ATOM_FEED *pFEED
142 );
143
144#ifdef __cplusplus
145}
146#endif
diff --git a/src/dutil/inc/buffutil.h b/src/dutil/inc/buffutil.h
new file mode 100644
index 00000000..e61cdb58
--- /dev/null
+++ b/src/dutil/inc/buffutil.h
@@ -0,0 +1,80 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9
10// macro definitions
11
12#define ReleaseBuffer ReleaseMem
13#define ReleaseNullBuffer ReleaseNullMem
14#define BuffFree MemFree
15
16
17// function declarations
18
19HRESULT BuffReadNumber(
20 __in_bcount(cbBuffer) const BYTE* pbBuffer,
21 __in SIZE_T cbBuffer,
22 __inout SIZE_T* piBuffer,
23 __out DWORD* pdw
24 );
25HRESULT BuffReadNumber64(
26 __in_bcount(cbBuffer) const BYTE* pbBuffer,
27 __in SIZE_T cbBuffer,
28 __inout SIZE_T* piBuffer,
29 __out DWORD64* pdw64
30 );
31HRESULT BuffReadString(
32 __in_bcount(cbBuffer) const BYTE* pbBuffer,
33 __in SIZE_T cbBuffer,
34 __inout SIZE_T* piBuffer,
35 __deref_out_z LPWSTR* pscz
36 );
37HRESULT BuffReadStringAnsi(
38 __in_bcount(cbBuffer) const BYTE* pbBuffer,
39 __in SIZE_T cbBuffer,
40 __inout SIZE_T* piBuffer,
41 __deref_out_z LPSTR* pscz
42 );
43HRESULT BuffReadStream(
44 __in_bcount(cbBuffer) const BYTE* pbBuffer,
45 __in SIZE_T cbBuffer,
46 __inout SIZE_T* piBuffer,
47 __deref_out_bcount(*pcbStream) BYTE** ppbStream,
48 __out SIZE_T* pcbStream
49 );
50
51HRESULT BuffWriteNumber(
52 __deref_out_bcount(*piBuffer) BYTE** ppbBuffer,
53 __inout SIZE_T* piBuffer,
54 __in DWORD dw
55 );
56HRESULT BuffWriteNumber64(
57 __deref_out_bcount(*piBuffer) BYTE** ppbBuffer,
58 __inout SIZE_T* piBuffer,
59 __in DWORD64 dw64
60 );
61HRESULT BuffWriteString(
62 __deref_out_bcount(*piBuffer) BYTE** ppbBuffer,
63 __inout SIZE_T* piBuffer,
64 __in_z_opt LPCWSTR scz
65 );
66HRESULT BuffWriteStringAnsi(
67 __deref_out_bcount(*piBuffer) BYTE** ppbBuffer,
68 __inout SIZE_T* piBuffer,
69 __in_z_opt LPCSTR scz
70 );
71HRESULT BuffWriteStream(
72 __deref_out_bcount(*piBuffer) BYTE** ppbBuffer,
73 __inout SIZE_T* piBuffer,
74 __in_bcount(cbStream) const BYTE* pbStream,
75 __in SIZE_T cbStream
76 );
77
78#ifdef __cplusplus
79}
80#endif
diff --git a/src/dutil/inc/butil.h b/src/dutil/inc/butil.h
new file mode 100644
index 00000000..a42cac11
--- /dev/null
+++ b/src/dutil/inc/butil.h
@@ -0,0 +1,31 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9enum BUNDLE_INSTALL_CONTEXT
10{
11 BUNDLE_INSTALL_CONTEXT_MACHINE,
12 BUNDLE_INSTALL_CONTEXT_USER,
13};
14
15HRESULT DAPI BundleGetBundleInfo(
16 __in LPCWSTR szBundleId, // Bundle code
17 __in LPCWSTR szAttribute, // attribute name
18 __out_ecount_opt(*pcchValueBuf) LPWSTR lpValueBuf, // returned value, NULL if not desired
19 __inout_opt LPDWORD pcchValueBuf // in/out buffer character count
20 );
21
22HRESULT DAPI BundleEnumRelatedBundle(
23 __in LPCWSTR lpUpgradeCode,
24 __in BUNDLE_INSTALL_CONTEXT context,
25 __inout PDWORD pdwStartIndex,
26 __out_ecount(MAX_GUID_CHARS+1) LPWSTR lpBundleIdBuf
27 );
28
29#ifdef __cplusplus
30}
31#endif
diff --git a/src/dutil/inc/cabcutil.h b/src/dutil/inc/cabcutil.h
new file mode 100644
index 00000000..4f0c7b13
--- /dev/null
+++ b/src/dutil/inc/cabcutil.h
@@ -0,0 +1,62 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <fci.h>
6#include <fcntl.h>
7#include <msi.h>
8
9// Callback from PFNFCIGETNEXTCABINET CabCGetNextCabinet method
10// First argument is the name of splitting cabinet without extension e.g. "cab1"
11// Second argument is name of the new cabinet that would be formed by splitting e.g. "cab1b.cab"
12// Third argument is the file token of the first file present in the splitting cabinet
13typedef void (__stdcall * FileSplitCabNamesCallback)(LPWSTR, LPWSTR, LPWSTR);
14
15#define CAB_MAX_SIZE 0x7FFFFFFF // (see KB: Q174866)
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21extern const int CABC_HANDLE_BYTES;
22
23// time vs. space trade-off
24typedef enum COMPRESSION_TYPE
25{
26 COMPRESSION_TYPE_NONE, // fastest
27 COMPRESSION_TYPE_LOW,
28 COMPRESSION_TYPE_MEDIUM,
29 COMPRESSION_TYPE_HIGH, // smallest
30 COMPRESSION_TYPE_MSZIP
31} COMPRESSION_TYPE;
32
33// functions
34HRESULT DAPI CabCBegin(
35 __in_z LPCWSTR wzCab,
36 __in_z LPCWSTR wzCabDir,
37 __in DWORD dwMaxFiles,
38 __in DWORD dwMaxSize,
39 __in DWORD dwMaxThresh,
40 __in COMPRESSION_TYPE ct,
41 __out_bcount(CABC_HANDLE_BYTES) HANDLE *phContext
42 );
43HRESULT DAPI CabCNextCab(
44 __in_bcount(CABC_HANDLE_BYTES) HANDLE hContext
45 );
46HRESULT DAPI CabCAddFile(
47 __in_z LPCWSTR wzFile,
48 __in_z_opt LPCWSTR wzToken,
49 __in_opt PMSIFILEHASHINFO pmfHash,
50 __in_bcount(CABC_HANDLE_BYTES) HANDLE hContext
51 );
52HRESULT DAPI CabCFinish(
53 __in_bcount(CABC_HANDLE_BYTES) HANDLE hContext,
54 __in_opt FileSplitCabNamesCallback fileSplitCabNamesCallback
55 );
56void DAPI CabCCancel(
57 __in_bcount(CABC_HANDLE_BYTES) HANDLE hContext
58 );
59
60#ifdef __cplusplus
61}
62#endif
diff --git a/src/dutil/inc/cabutil.h b/src/dutil/inc/cabutil.h
new file mode 100644
index 00000000..0bedba80
--- /dev/null
+++ b/src/dutil/inc/cabutil.h
@@ -0,0 +1,56 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <fdi.h>
6#include <sys\stat.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12// structs
13
14
15// callback function prototypes
16typedef HRESULT (*CAB_CALLBACK_OPEN_FILE)(LPCWSTR wzFile, INT_PTR* ppFile);
17typedef HRESULT (*CAB_CALLBACK_READ_FILE)(INT_PTR pFile, LPVOID pvData, DWORD cbData, DWORD* pcbRead);
18typedef HRESULT (*CAB_CALLBACK_WRITE_FILE)(INT_PTR pFile, LPVOID pvData, DWORD cbData, DWORD* pcbRead);
19typedef LONG (*CAB_CALLBACK_SEEK_FILE)(INT_PTR pFile, DWORD dwMove, DWORD dwMoveMethod);
20typedef HRESULT (*CAB_CALLBACK_CLOSE_FILE)(INT_PTR pFile);
21
22typedef HRESULT (*CAB_CALLBACK_BEGIN_FILE)(LPCWSTR wzFileId, FILETIME* pftFileTime, DWORD cbFileSize, LPVOID pvContext, INT_PTR* ppFile);
23typedef HRESULT (*CAB_CALLBACK_END_FILE)(LPCWSTR wzFileId, LPVOID pvContext, INT_PTR pFile);
24typedef HRESULT (*CAB_CALLBACK_PROGRESS)(BOOL fBeginFile, LPCWSTR wzFileId, LPVOID pvContext);
25
26// function type with calling convention of __stdcall that .NET 1.1 understands only
27// .NET 2.0 will not need this
28typedef INT_PTR (FAR __stdcall *STDCALL_PFNFDINOTIFY)(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin);
29
30
31// functions
32HRESULT DAPI CabInitialize(
33 __in BOOL fDelayLoad
34 );
35void DAPI CabUninitialize(
36 );
37
38HRESULT DAPI CabExtract(
39 __in_z LPCWSTR wzCabinet,
40 __in_z LPCWSTR wzExtractFile,
41 __in_z LPCWSTR wzExtractDir,
42 __in_opt CAB_CALLBACK_PROGRESS pfnProgress,
43 __in_opt LPVOID pvContext,
44 __in DWORD64 dw64EmbeddedOffset
45 );
46
47HRESULT DAPI CabEnumerate(
48 __in_z LPCWSTR wzCabinet,
49 __in_z LPCWSTR wzEnumerateFile,
50 __in STDCALL_PFNFDINOTIFY pfnNotify,
51 __in DWORD64 dw64EmbeddedOffset
52 );
53
54#ifdef __cplusplus
55}
56#endif
diff --git a/src/dutil/inc/certutil.h b/src/dutil/inc/certutil.h
new file mode 100644
index 00000000..8565c1cf
--- /dev/null
+++ b/src/dutil/inc/certutil.h
@@ -0,0 +1,66 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#define ReleaseCertStore(p) if (p) { ::CertCloseStore(p, 0); p = NULL; }
6#define ReleaseCertContext(p) if (p) { ::CertFreeCertificateContext(p); p = NULL; }
7#define ReleaseCertChain(p) if (p) { ::CertFreeCertificateChain(p); p = NULL; }
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13HRESULT DAPI CertReadProperty(
14 __in PCCERT_CONTEXT pCertContext,
15 __in DWORD dwProperty,
16 __out_bcount(*pcbValue) LPVOID pvValue,
17 __out_opt DWORD* pcbValue
18 );
19
20HRESULT DAPI CertGetAuthenticodeSigningTimestamp(
21 __in CMSG_SIGNER_INFO* pSignerInfo,
22 __out FILETIME* pft
23 );
24
25HRESULT DAPI GetCryptProvFromCert(
26 __in_opt HWND hwnd,
27 __in PCCERT_CONTEXT pCert,
28 __out HCRYPTPROV *phCryptProv,
29 __out DWORD *pdwKeySpec,
30 __in BOOL *pfDidCryptAcquire,
31 __deref_opt_out LPWSTR *ppwszTmpContainer,
32 __deref_opt_out LPWSTR *ppwszProviderName,
33 __out DWORD *pdwProviderType
34 );
35
36HRESULT DAPI FreeCryptProvFromCert(
37 __in BOOL fAcquired,
38 __in HCRYPTPROV hProv,
39 __in_opt LPWSTR pwszCapiProvider,
40 __in DWORD dwProviderType,
41 __in_opt LPWSTR pwszTmpContainer
42 );
43
44HRESULT DAPI GetProvSecurityDesc(
45 __in HCRYPTPROV hProv,
46 __deref_out SECURITY_DESCRIPTOR** pSecurity
47 );
48
49HRESULT DAPI SetProvSecurityDesc(
50 __in HCRYPTPROV hProv,
51 __in SECURITY_DESCRIPTOR* pSecurity
52 );
53
54BOOL DAPI CertHasPrivateKey(
55 __in PCCERT_CONTEXT pCertContext,
56 __out_opt DWORD* pdwKeySpec
57 );
58
59HRESULT DAPI CertInstallSingleCertificate(
60 __in HCERTSTORE hStore,
61 __in PCCERT_CONTEXT pCertContext,
62 __in LPCWSTR wzName
63 );
64#ifdef __cplusplus
65}
66#endif
diff --git a/src/dutil/inc/condutil.h b/src/dutil/inc/condutil.h
new file mode 100644
index 00000000..fb960042
--- /dev/null
+++ b/src/dutil/inc/condutil.h
@@ -0,0 +1,19 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#if defined(__cplusplus)
6extern "C" {
7#endif
8
9// function declarations
10
11HRESULT DAPI CondEvaluate(
12 __in VARIABLES_HANDLE pVariables,
13 __in_z LPCWSTR wzCondition,
14 __out BOOL* pf
15 );
16
17#if defined(__cplusplus)
18}
19#endif
diff --git a/src/dutil/inc/conutil.h b/src/dutil/inc/conutil.h
new file mode 100644
index 00000000..cfb65332
--- /dev/null
+++ b/src/dutil/inc/conutil.h
@@ -0,0 +1,78 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ConsoleExitOnFailure(x, c, f, ...) if (FAILED(x)) { ConsoleWriteError(x, c, f, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
10#define ConsoleExitOnLastError(x, c, f, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { ConsoleWriteError(x, c, f, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; } }
11#define ConsoleExitOnNull(p, x, e, c, f, ...) if (NULL == p) { x = e; ConsoleWriteError(x, c, f, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
12
13
14// the following macros need to go away
15#define ConsoleTrace(l, f, ...) { ConsoleWriteLine(CONSOLE_COLOR_NORMAL, f, __VA_ARGS__); Trace(l, f, __VA_ARGS__); }
16#define ConsoleWarning(f, ...) { ConsoleWriteLine(CONSOLE_COLOR_YELLOW, f, __VA_ARGS__); Trace(REPORT_STANDARD, f, __VA_ARGS__); }
17#define ConsoleError(x, f, ...) { ConsoleWriteError(x, CONSOLE_COLOR_RED, f, __VA_ARGS__); TraceError(x, f, __VA_ARGS__); }
18
19
20// enums
21typedef enum CONSOLE_COLOR { CONSOLE_COLOR_NORMAL, CONSOLE_COLOR_RED, CONSOLE_COLOR_YELLOW, CONSOLE_COLOR_GREEN } CONSOLE_COLOR;
22
23// structs
24
25// functions
26HRESULT DAPI ConsoleInitialize();
27void DAPI ConsoleUninitialize();
28
29void DAPI ConsoleGreen();
30void DAPI ConsoleRed();
31void DAPI ConsoleYellow();
32void DAPI ConsoleNormal();
33
34HRESULT DAPI ConsoleWrite(
35 CONSOLE_COLOR cc,
36 __in_z __format_string LPCSTR szFormat,
37 ...
38 );
39HRESULT DAPI ConsoleWriteLine(
40 CONSOLE_COLOR cc,
41 __in_z __format_string LPCSTR szFormat,
42 ...
43 );
44HRESULT DAPI ConsoleWriteError(
45 HRESULT hrError,
46 CONSOLE_COLOR cc,
47 __in_z __format_string LPCSTR szFormat,
48 ...
49 );
50
51HRESULT DAPI ConsoleReadW(
52 __deref_out_z LPWSTR* ppwzBuffer
53 );
54
55HRESULT DAPI ConsoleReadStringA(
56 __deref_out_ecount_part(cchCharBuffer,*pcchNumCharReturn) LPSTR* szCharBuffer,
57 CONST DWORD cchCharBuffer,
58 __out DWORD* pcchNumCharReturn
59 );
60HRESULT DAPI ConsoleReadStringW(
61 __deref_out_ecount_part(cchCharBuffer,*pcchNumCharReturn) LPWSTR* szCharBuffer,
62 CONST DWORD cchCharBuffer,
63 __out DWORD* pcchNumCharReturn
64 );
65
66HRESULT DAPI ConsoleReadNonBlockingW(
67 __deref_out_ecount_opt(*pcchSize) LPWSTR* ppwzBuffer,
68 __out DWORD* pcchSize,
69 BOOL fReadLine
70 );
71
72HRESULT DAPI ConsoleSetReadHidden(void);
73HRESULT DAPI ConsoleSetReadNormal(void);
74
75#ifdef __cplusplus
76}
77#endif
78
diff --git a/src/dutil/inc/cryputil.h b/src/dutil/inc/cryputil.h
new file mode 100644
index 00000000..88aa784d
--- /dev/null
+++ b/src/dutil/inc/cryputil.h
@@ -0,0 +1,103 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#define ReleaseCryptMsg(p) if (p) { ::CryptMsgClose(p); p = NULL; }
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11
12// Use CRYPTPROTECTMEMORY_BLOCK_SIZE, because it's larger and thus more restrictive than RTL_ENCRYPT_MEMORY_SIZE.
13#define CRYP_ENCRYPT_MEMORY_SIZE CRYPTPROTECTMEMORY_BLOCK_SIZE
14#define SHA1_HASH_LEN 20
15
16typedef NTSTATUS (APIENTRY *PFN_RTLENCRYPTMEMORY)(
17 __inout PVOID Memory,
18 __in ULONG MemoryLength,
19 __in ULONG OptionFlags
20 );
21
22typedef NTSTATUS (APIENTRY *PFN_RTLDECRYPTMEMORY)(
23 __inout PVOID Memory,
24 __in ULONG MemoryLength,
25 __in ULONG OptionFlags
26 );
27
28typedef BOOL (APIENTRY *PFN_CRYPTPROTECTMEMORY)(
29 __inout LPVOID pData,
30 __in DWORD cbData,
31 __in DWORD dwFlags
32 );
33
34typedef BOOL (APIENTRY *PFN_CRYPTUNPROTECTMEMORY)(
35 __inout LPVOID pData,
36 __in DWORD cbData,
37 __in DWORD dwFlags
38 );
39
40// function declarations
41
42HRESULT DAPI CrypInitialize();
43void DAPI CrypUninitialize();
44
45HRESULT DAPI CrypDecodeObject(
46 __in_z LPCSTR szStructType,
47 __in_ecount(cbData) const BYTE* pbData,
48 __in DWORD cbData,
49 __in DWORD dwFlags,
50 __out LPVOID* ppvObject,
51 __out_opt DWORD* pcbObject
52 );
53
54HRESULT DAPI CrypMsgGetParam(
55 __in HCRYPTMSG hCryptMsg,
56 __in DWORD dwType,
57 __in DWORD dwIndex,
58 __out LPVOID* ppvData,
59 __out_opt DWORD* pcbData
60 );
61
62HRESULT DAPI CrypHashFile(
63 __in_z LPCWSTR wzFilePath,
64 __in DWORD dwProvType,
65 __in ALG_ID algid,
66 __out_bcount(cbHash) BYTE* pbHash,
67 __in DWORD cbHash,
68 __out_opt DWORD64* pqwBytesHashed
69 );
70
71HRESULT DAPI CrypHashFileHandle(
72 __in HANDLE hFile,
73 __in DWORD dwProvType,
74 __in ALG_ID algid,
75 __out_bcount(cbHash) BYTE* pbHash,
76 __in DWORD cbHash,
77 __out_opt DWORD64* pqwBytesHashed
78 );
79
80HRESULT DAPI CrypHashBuffer(
81 __in_bcount(cbBuffer) const BYTE* pbBuffer,
82 __in SIZE_T cbBuffer,
83 __in DWORD dwProvType,
84 __in ALG_ID algid,
85 __out_bcount(cbHash) BYTE* pbHash,
86 __in DWORD cbHash
87 );
88
89HRESULT DAPI CrypEncryptMemory(
90 __inout LPVOID pData,
91 __in DWORD cbData,
92 __in DWORD dwFlags
93 );
94
95HRESULT DAPI CrypDecryptMemory(
96 __inout LPVOID pData,
97 __in DWORD cbData,
98 __in DWORD dwFlags
99 );
100
101#ifdef __cplusplus
102}
103#endif
diff --git a/src/dutil/inc/dictutil.h b/src/dutil/inc/dictutil.h
new file mode 100644
index 00000000..f0a3bb5a
--- /dev/null
+++ b/src/dutil/inc/dictutil.h
@@ -0,0 +1,69 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseDict(sdh) if (sdh) { DictDestroy(sdh); }
10#define ReleaseNullDict(sdh) if (sdh) { DictDestroy(sdh); sdh = NULL; }
11
12typedef void* STRINGDICT_HANDLE;
13typedef const void* C_STRINGDICT_HANDLE;
14
15extern const int STRINGDICT_HANDLE_BYTES;
16
17typedef enum DICT_FLAG
18{
19 DICT_FLAG_NONE = 0,
20 DICT_FLAG_CASEINSENSITIVE = 1
21} DICT_FLAG;
22
23HRESULT DAPI DictCreateWithEmbeddedKey(
24 __out_bcount(STRINGDICT_HANDLE_BYTES) STRINGDICT_HANDLE* psdHandle,
25 __in DWORD dwNumExpectedItems,
26 __in_opt void **ppvArray,
27 __in size_t cByteOffset,
28 __in DICT_FLAG dfFlags
29 );
30HRESULT DAPI DictCreateStringList(
31 __out_bcount(STRINGDICT_HANDLE_BYTES) STRINGDICT_HANDLE* psdHandle,
32 __in DWORD dwNumExpectedItems,
33 __in DICT_FLAG dfFlags
34 );
35HRESULT DAPI DictCreateStringListFromArray(
36 __out_bcount(STRINGDICT_HANDLE_BYTES) STRINGDICT_HANDLE* psdHandle,
37 __in_ecount(cStringArray) const LPCWSTR* rgwzStringArray,
38 __in const DWORD cStringArray,
39 __in DICT_FLAG dfFlags
40 );
41HRESULT DAPI DictCompareStringListToArray(
42 __in_bcount(STRINGDICT_HANDLE_BYTES) STRINGDICT_HANDLE sdStringList,
43 __in_ecount(cStringArray) const LPCWSTR* rgwzStringArray,
44 __in const DWORD cStringArray
45 );
46HRESULT DAPI DictAddKey(
47 __in_bcount(STRINGDICT_HANDLE_BYTES) STRINGDICT_HANDLE sdHandle,
48 __in_z LPCWSTR szString
49 );
50HRESULT DAPI DictAddValue(
51 __in_bcount(STRINGDICT_HANDLE_BYTES) STRINGDICT_HANDLE sdHandle,
52 __in void *pvValue
53 );
54HRESULT DAPI DictKeyExists(
55 __in_bcount(STRINGDICT_HANDLE_BYTES) C_STRINGDICT_HANDLE sdHandle,
56 __in_z LPCWSTR szString
57 );
58HRESULT DAPI DictGetValue(
59 __in_bcount(STRINGDICT_HANDLE_BYTES) C_STRINGDICT_HANDLE sdHandle,
60 __in_z LPCWSTR szString,
61 __out void **ppvValue
62 );
63void DAPI DictDestroy(
64 __in_bcount(STRINGDICT_HANDLE_BYTES) STRINGDICT_HANDLE sdHandle
65 );
66
67#ifdef __cplusplus
68}
69#endif
diff --git a/src/dutil/inc/dirutil.h b/src/dutil/inc/dirutil.h
new file mode 100644
index 00000000..0a19a9c0
--- /dev/null
+++ b/src/dutil/inc/dirutil.h
@@ -0,0 +1,54 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5typedef enum DIR_DELETE
6{
7 DIR_DELETE_FILES = 1,
8 DIR_DELETE_RECURSE = 2,
9 DIR_DELETE_SCHEDULE = 4,
10} DIR_DELETE;
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16BOOL DAPI DirExists(
17 __in_z LPCWSTR wzPath,
18 __out_opt DWORD *pdwAttributes
19 );
20
21HRESULT DAPI DirCreateTempPath(
22 __in_z LPCWSTR wzPrefix,
23 __out_ecount_z(cchPath) LPWSTR wzPath,
24 __in DWORD cchPath
25 );
26
27HRESULT DAPI DirEnsureExists(
28 __in_z LPCWSTR wzPath,
29 __in_opt LPSECURITY_ATTRIBUTES psa
30 );
31
32HRESULT DAPI DirEnsureDelete(
33 __in_z LPCWSTR wzPath,
34 __in BOOL fDeleteFiles,
35 __in BOOL fRecurse
36 );
37
38HRESULT DAPI DirEnsureDeleteEx(
39 __in_z LPCWSTR wzPath,
40 __in DWORD dwFlags
41 );
42
43HRESULT DAPI DirGetCurrent(
44 __deref_out_z LPWSTR* psczCurrentDirectory
45 );
46
47HRESULT DAPI DirSetCurrent(
48 __in_z LPCWSTR wzDirectory
49 );
50
51#ifdef __cplusplus
52}
53#endif
54
diff --git a/src/dutil/inc/dlutil.h b/src/dutil/inc/dlutil.h
new file mode 100644
index 00000000..3e95103a
--- /dev/null
+++ b/src/dutil/inc/dlutil.h
@@ -0,0 +1,59 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9typedef HRESULT (WINAPI *LPAUTHENTICATION_ROUTINE)(
10 __in LPVOID pVoid,
11 __in HINTERNET hUrl,
12 __in long lHttpCode,
13 __out BOOL* pfRetrySend,
14 __out BOOL* pfRetry
15 );
16
17typedef int (WINAPI *LPCANCEL_ROUTINE)(
18 __in HRESULT hrError,
19 __in_z_opt LPCWSTR wzError,
20 __in BOOL fAllowRetry,
21 __in_opt LPVOID pvContext
22 );
23
24// structs
25typedef struct _DOWNLOAD_SOURCE
26{
27 LPWSTR sczUrl;
28 LPWSTR sczUser;
29 LPWSTR sczPassword;
30} DOWNLOAD_SOURCE;
31
32typedef struct _DOWNLOAD_CACHE_CALLBACK
33{
34 LPPROGRESS_ROUTINE pfnProgress;
35 LPCANCEL_ROUTINE pfnCancel;
36 LPVOID pv;
37} DOWNLOAD_CACHE_CALLBACK;
38
39typedef struct _DOWNLOAD_AUTHENTICATION_CALLBACK
40{
41 LPAUTHENTICATION_ROUTINE pfnAuthenticate;
42 LPVOID pv;
43} DOWNLOAD_AUTHENTICATION_CALLBACK;
44
45
46// functions
47
48HRESULT DAPI DownloadUrl(
49 __in DOWNLOAD_SOURCE* pDownloadSource,
50 __in DWORD64 dw64AuthoredDownloadSize,
51 __in LPCWSTR wzDestinationPath,
52 __in_opt DOWNLOAD_CACHE_CALLBACK* pCache,
53 __in_opt DOWNLOAD_AUTHENTICATION_CALLBACK* pAuthenticate
54 );
55
56
57#ifdef __cplusplus
58}
59#endif
diff --git a/src/dutil/inc/dutil.h b/src/dutil/inc/dutil.h
new file mode 100644
index 00000000..3791dd5a
--- /dev/null
+++ b/src/dutil/inc/dutil.h
@@ -0,0 +1,160 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#define DAPI __stdcall
6#define DAPIV __cdecl // used only for functions taking variable length arguments
7
8#define DAPI_(type) EXTERN_C type DAPI
9#define DAPIV_(type) EXTERN_C type DAPIV
10
11
12// enums
13typedef enum REPORT_LEVEL
14{
15 REPORT_NONE, // turns off report (only valid for XXXSetLevel())
16 REPORT_WARNING, // written if want only warnings or reporting is on in general
17 REPORT_STANDARD, // written if reporting is on
18 REPORT_VERBOSE, // written only if verbose reporting is on
19 REPORT_DEBUG, // reporting useful when debugging code
20 REPORT_ERROR, // always gets reported, but can never be specified
21} REPORT_LEVEL;
22
23// asserts and traces
24typedef BOOL (DAPI *DUTIL_ASSERTDISPLAYFUNCTION)(__in_z LPCSTR sz);
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30void DAPI Dutil_SetAssertModule(__in HMODULE hAssertModule);
31void DAPI Dutil_SetAssertDisplayFunction(__in DUTIL_ASSERTDISPLAYFUNCTION pfn);
32void DAPI Dutil_Assert(__in_z LPCSTR szFile, __in int iLine);
33void DAPI Dutil_AssertSz(__in_z LPCSTR szFile, __in int iLine, __in_z LPCSTR szMessage);
34
35void DAPI Dutil_TraceSetLevel(__in REPORT_LEVEL ll, __in BOOL fTraceFilenames);
36REPORT_LEVEL DAPI Dutil_TraceGetLevel();
37void __cdecl Dutil_Trace(__in_z LPCSTR szFile, __in int iLine, __in REPORT_LEVEL rl, __in_z __format_string LPCSTR szMessage, ...);
38void __cdecl Dutil_TraceError(__in_z LPCSTR szFile, __in int iLine, __in REPORT_LEVEL rl, __in HRESULT hr, __in_z __format_string LPCSTR szMessage, ...);
39void DAPI Dutil_RootFailure(__in_z LPCSTR szFile, __in int iLine, __in HRESULT hrError);
40
41#ifdef __cplusplus
42}
43#endif
44
45
46#ifdef DEBUG
47
48#define AssertSetModule(m) (void)Dutil_SetAssertModule(m)
49#define AssertSetDisplayFunction(pfn) (void)Dutil_SetAssertDisplayFunction(pfn)
50#define Assert(f) ((f) ? (void)0 : (void)Dutil_Assert(__FILE__, __LINE__))
51#define AssertSz(f, sz) ((f) ? (void)0 : (void)Dutil_AssertSz(__FILE__, __LINE__, sz))
52
53#define TraceSetLevel(l, f) (void)Dutil_TraceSetLevel(l, f)
54#define TraceGetLevel() (REPORT_LEVEL)Dutil_TraceGetLevel()
55#define Trace(l, f, ...) (void)Dutil_Trace(__FILE__, __LINE__, l, f, __VA_ARGS__)
56#define TraceError(x, f, ...) (void)Dutil_TraceError(__FILE__, __LINE__, REPORT_ERROR, x, f, __VA_ARGS__)
57#define TraceErrorDebug(x, f, ...) (void)Dutil_TraceError(__FILE__, __LINE__, REPORT_DEBUG, x, f, __VA_ARGS__)
58
59#else // !DEBUG
60
61#define AssertSetModule(m)
62#define AssertSetDisplayFunction(pfn)
63#define Assert(f)
64#define AssertSz(f, sz)
65
66#define TraceSetLevel(l, f)
67#define Trace(l, f, ...)
68#define TraceError(x, f, ...)
69#define TraceErrorDebug(x, f, ...)
70
71#endif // DEBUG
72
73// ExitTrace can be overriden
74#ifndef ExitTrace
75#define ExitTrace TraceError
76#endif
77
78// Exit macros
79#define ExitFunction() { goto LExit; }
80#define ExitFunction1(x) { x; goto LExit; }
81
82#define ExitFunctionWithLastError(x) { x = HRESULT_FROM_WIN32(::GetLastError()); goto LExit; }
83
84#define ExitOnLastError(x, s, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (FAILED(x)) { Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, s, __VA_ARGS__); goto LExit; } }
85#define ExitOnLastErrorDebugTrace(x, s, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (FAILED(x)) { Dutil_RootFailure(__FILE__, __LINE__, x); TraceErrorDebug(x, s, __VA_ARGS__); goto LExit; } }
86#define ExitWithLastError(x, s, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, s, __VA_ARGS__); goto LExit; }
87#define ExitOnFailure(x, s, ...) if (FAILED(x)) { ExitTrace(x, s, __VA_ARGS__); goto LExit; }
88#define ExitOnRootFailure(x, s, ...) if (FAILED(x)) { Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, s, __VA_ARGS__); goto LExit; }
89#define ExitOnFailureDebugTrace(x, s, ...) if (FAILED(x)) { TraceErrorDebug(x, s, __VA_ARGS__); goto LExit; }
90#define ExitOnNull(p, x, e, s, ...) if (NULL == p) { x = e; Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, s, __VA_ARGS__); goto LExit; }
91#define ExitOnNullWithLastError(p, x, s, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, s, __VA_ARGS__); goto LExit; }
92#define ExitOnNullDebugTrace(p, x, e, s, ...) if (NULL == p) { x = e; Dutil_RootFailure(__FILE__, __LINE__, x); TraceErrorDebug(x, s, __VA_ARGS__); goto LExit; }
93#define ExitOnInvalidHandleWithLastError(p, x, s, ...) if (INVALID_HANDLE_VALUE == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, s, __VA_ARGS__); goto LExit; }
94#define ExitOnWin32Error(e, x, s, ...) if (ERROR_SUCCESS != e) { x = HRESULT_FROM_WIN32(e); if (!FAILED(x)) { x = E_FAIL; } Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, s, __VA_ARGS__); goto LExit; }
95
96// release macros
97#define ReleaseObject(x) if (x) { x->Release(); }
98#define ReleaseObjectArray(prg, cel) if (prg) { for (DWORD Dutil_ReleaseObjectArrayIndex = 0; Dutil_ReleaseObjectArrayIndex < cel; ++Dutil_ReleaseObjectArrayIndex) { ReleaseObject(prg[Dutil_ReleaseObjectArrayIndex]); } ReleaseMem(prg); }
99#define ReleaseVariant(x) { ::VariantClear(&x); }
100#define ReleaseNullObject(x) if (x) { (x)->Release(); x = NULL; }
101#define ReleaseCertificate(x) if (x) { ::CertFreeCertificateContext(x); x=NULL; }
102#define ReleaseHandle(x) if (x) { ::CloseHandle(x); x = NULL; }
103
104
105// useful defines and macros
106#define Unused(x) ((void)x)
107
108#ifndef countof
109#if 1
110#define countof(ary) (sizeof(ary) / sizeof(ary[0]))
111#else
112#ifndef __cplusplus
113#define countof(ary) (sizeof(ary) / sizeof(ary[0]))
114#else
115template<typename T> static char countofVerify(void const *, T) throw() { return 0; }
116template<typename T> static void countofVerify(T *const, T *const *) throw() {};
117#define countof(arr) (sizeof(countofVerify(arr,&(arr))) * sizeof(arr)/sizeof(*(arr)))
118#endif
119#endif
120#endif
121
122#define roundup(x, n) roundup_typed(x, n, DWORD)
123#define roundup_typed(x, n, t) (((t)(x) + ((t)(n) - 1)) & ~((t)(n) - 1))
124
125#define HRESULT_FROM_RPC(x) ((HRESULT) ((x) | FACILITY_RPC))
126
127#ifndef MAXSIZE_T
128#define MAXSIZE_T ((SIZE_T)~((SIZE_T)0))
129#endif
130
131typedef const BYTE* LPCBYTE;
132
133#define E_FILENOTFOUND HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
134#define E_PATHNOTFOUND HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)
135#define E_INVALIDDATA HRESULT_FROM_WIN32(ERROR_INVALID_DATA)
136#define E_INVALIDSTATE HRESULT_FROM_WIN32(ERROR_INVALID_STATE)
137#define E_INSUFFICIENT_BUFFER HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
138#define E_MOREDATA HRESULT_FROM_WIN32(ERROR_MORE_DATA)
139#define E_NOMOREITEMS HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)
140#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
141#define E_MODNOTFOUND HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)
142#define E_BADCONFIGURATION HRESULT_FROM_WIN32(ERROR_BAD_CONFIGURATION)
143
144#define AddRefAndRelease(x) { x->AddRef(); x->Release(); }
145
146#define MAKEDWORD(lo, hi) ((DWORD)MAKELONG(lo, hi))
147#define MAKEQWORDVERSION(mj, mi, b, r) (((DWORD64)MAKELONG(r, b)) | (((DWORD64)MAKELONG(mi, mj)) << 32))
148
149
150#ifdef __cplusplus
151extern "C" {
152#endif
153
154// other functions
155HRESULT DAPI LoadSystemLibrary(__in_z LPCWSTR wzModuleName, __out HMODULE *phModule);
156HRESULT DAPI LoadSystemLibraryWithPath(__in_z LPCWSTR wzModuleName, __out HMODULE *phModule, __deref_out_z_opt LPWSTR* psczPath);
157
158#ifdef __cplusplus
159}
160#endif
diff --git a/src/dutil/inc/eseutil.h b/src/dutil/inc/eseutil.h
new file mode 100644
index 00000000..1c408927
--- /dev/null
+++ b/src/dutil/inc/eseutil.h
@@ -0,0 +1,223 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseEseQuery(pqh) if (pqh) { EseFinishQuery(pqh); }
10#define ReleaseNullEseQuery(pqh) if (pqh) { EseFinishQuery(pqh); pqh = NULL; }
11
12struct ESE_COLUMN_SCHEMA
13{
14 JET_COLUMNID jcColumn;
15 LPCWSTR pszName;
16 JET_COLTYP jcColumnType;
17 BOOL fKey; // If this column is part of the key of the table
18 BOOL fFixed;
19 BOOL fNullable;
20 BOOL fAutoIncrement;
21};
22
23struct ESE_TABLE_SCHEMA
24{
25 JET_TABLEID jtTable;
26 LPCWSTR pszName;
27 DWORD dwColumns;
28 ESE_COLUMN_SCHEMA *pcsColumns;
29};
30
31struct ESE_DATABASE_SCHEMA
32{
33 DWORD dwTables;
34 ESE_TABLE_SCHEMA *ptsTables;
35};
36
37typedef enum ESE_QUERY_TYPE
38{
39 ESE_QUERY_EXACT,
40 ESE_QUERY_FROM_TOP,
41 ESE_QUERY_FROM_BOTTOM
42} ESE_QUERY_TYPE;
43
44typedef void* ESE_QUERY_HANDLE;
45
46HRESULT DAPI EseBeginSession(
47 __out JET_INSTANCE *pjiInstance,
48 __out JET_SESID *pjsSession,
49 __in_z LPCWSTR pszInstance,
50 __in_z LPCWSTR pszPath
51 );
52HRESULT DAPI EseEndSession(
53 __in JET_INSTANCE jiInstance,
54 __in JET_SESID jsSession
55 );
56HRESULT DAPI EseEnsureDatabase(
57 __in JET_SESID jsSession,
58 __in_z LPCWSTR pszFile,
59 __in ESE_DATABASE_SCHEMA *pdsSchema,
60 __out JET_DBID* pjdbDb,
61 __in BOOL fExclusive,
62 __in BOOL fReadonly
63 );
64HRESULT DAPI EseCloseDatabase(
65 __in JET_SESID jsSession,
66 __in JET_DBID jdbDb
67 );
68HRESULT DAPI EseCreateTable(
69 __in JET_SESID jsSession,
70 __in JET_DBID jdbDb,
71 __in_z LPCWSTR pszTable,
72 __out JET_TABLEID *pjtTable
73 );
74HRESULT DAPI EseOpenTable(
75 __in JET_SESID jsSession,
76 __in JET_DBID jdbDb,
77 __in_z LPCWSTR pszTable,
78 __out JET_TABLEID *pjtTable
79 );
80HRESULT DAPI EseCloseTable(
81 __in JET_SESID jsSession,
82 __in JET_TABLEID jtTable
83 );
84HRESULT DAPI EseEnsureColumn(
85 __in JET_SESID jsSession,
86 __in JET_TABLEID jtTable,
87 __in_z LPCWSTR pszColumnName,
88 __in JET_COLTYP jcColumnType,
89 __in ULONG ulColumnSize,
90 __in BOOL fFixed,
91 __in BOOL fNullable,
92 __out_opt JET_COLUMNID *pjcColumn
93 );
94HRESULT DAPI EseGetColumn(
95 __in JET_SESID jsSession,
96 __in JET_TABLEID jtTable,
97 __in_z LPCWSTR pszColumnName,
98 __out JET_COLUMNID *pjcColumn
99 );
100HRESULT DAPI EseMoveCursor(
101 __in JET_SESID jsSession,
102 __in JET_TABLEID jtTable,
103 __in LONG lRow
104 );
105HRESULT DAPI EseDeleteRow(
106 __in JET_SESID jsSession,
107 __in JET_TABLEID jtTable
108 );
109HRESULT DAPI EseBeginTransaction(
110 __in JET_SESID jsSession
111 );
112HRESULT DAPI EseRollbackTransaction(
113 __in JET_SESID jsSession,
114 __in BOOL fAll
115 );
116HRESULT DAPI EseCommitTransaction(
117 __in JET_SESID jsSession
118 );
119HRESULT DAPI EsePrepareUpdate(
120 __in JET_SESID jsSession,
121 __in JET_TABLEID jtTable,
122 __in ULONG ulPrep
123 );
124HRESULT DAPI EseFinishUpdate(
125 __in JET_SESID jsSession,
126 __in JET_TABLEID jtTable,
127 __in BOOL fSeekToInsertedRecord
128 );
129HRESULT DAPI EseSetColumnBinary(
130 __in JET_SESID jsSession,
131 __in ESE_TABLE_SCHEMA tsTable,
132 __in DWORD dwColumn,
133 __in_bcount(cbBuffer) const BYTE* pbBuffer,
134 __in SIZE_T cbBuffer
135 );
136HRESULT DAPI EseSetColumnDword(
137 __in JET_SESID jsSession,
138 __in ESE_TABLE_SCHEMA tsTable,
139 __in DWORD dwColumn,
140 __in DWORD dwValue
141 );
142HRESULT DAPI EseSetColumnBool(
143 __in JET_SESID jsSession,
144 __in ESE_TABLE_SCHEMA tsTable,
145 __in DWORD dwColumn,
146 __in BOOL fValue
147 );
148HRESULT DAPI EseSetColumnString(
149 __in JET_SESID jsSession,
150 __in ESE_TABLE_SCHEMA tsTable,
151 __in DWORD dwColumn,
152 __in_z LPCWSTR pszValue
153 );
154HRESULT DAPI EseSetColumnEmpty(
155 __in JET_SESID jsSession,
156 __in ESE_TABLE_SCHEMA tsTable,
157 __in DWORD dwColumn
158 );
159HRESULT DAPI EseGetColumnBinary(
160 __in JET_SESID jsSession,
161 __in ESE_TABLE_SCHEMA tsTable,
162 __in DWORD dwColumn,
163 __deref_out_bcount(*piBuffer) BYTE** ppbBuffer,
164 __inout SIZE_T* piBuffer
165 );
166HRESULT DAPI EseGetColumnDword(
167 __in JET_SESID jsSession,
168 __in ESE_TABLE_SCHEMA tsTable,
169 __in DWORD dwColumn,
170 __out DWORD *pdwValue
171 );
172HRESULT DAPI EseGetColumnBool(
173 __in JET_SESID jsSession,
174 __in ESE_TABLE_SCHEMA tsTable,
175 __in DWORD dwColumn,
176 __out BOOL *pfValue
177 );
178HRESULT DAPI EseGetColumnString(
179 __in JET_SESID jsSession,
180 __in ESE_TABLE_SCHEMA tsTable,
181 __in DWORD dwColumn,
182 __out LPWSTR *ppszValue
183 );
184
185// Call this once for each key column in the table
186HRESULT DAPI EseBeginQuery(
187 __in JET_SESID jsSession,
188 __in JET_TABLEID jtTable,
189 __in ESE_QUERY_TYPE qtQueryType,
190 __out ESE_QUERY_HANDLE *peqhHandle
191 );
192HRESULT DAPI EseSetQueryColumnBinary(
193 __in ESE_QUERY_HANDLE eqhHandle,
194 __in_bcount(cbBuffer) const BYTE* pbBuffer,
195 __in SIZE_T cbBuffer,
196 __in BOOL fFinal // If this is true, all other key columns in the query will be set to "*"
197 );
198HRESULT DAPI EseSetQueryColumnDword(
199 __in ESE_QUERY_HANDLE eqhHandle,
200 __in DWORD dwData,
201 __in BOOL fFinal // If this is true, all other key columns in the query will be set to "*"
202 );
203HRESULT DAPI EseSetQueryColumnBool(
204 __in ESE_QUERY_HANDLE eqhHandle,
205 __in BOOL fValue,
206 __in BOOL fFinal // If this is true, all other key columns in the query will be set to "*"
207 );
208HRESULT DAPI EseSetQueryColumnString(
209 __in ESE_QUERY_HANDLE eqhHandle,
210 __in_z LPCWSTR pszString,
211 __in BOOL fFinal // If this is true, all other key columns in the query will be set to "*"
212 );
213HRESULT DAPI EseFinishQuery(
214 __in ESE_QUERY_HANDLE eqhHandle
215 );
216// Once all columns have been set up, call this and read the result
217HRESULT DAPI EseRunQuery(
218 __in ESE_QUERY_HANDLE eqhHandle
219 );
220
221#ifdef __cplusplus
222}
223#endif
diff --git a/src/dutil/inc/fileutil.h b/src/dutil/inc/fileutil.h
new file mode 100644
index 00000000..ddae340f
--- /dev/null
+++ b/src/dutil/inc/fileutil.h
@@ -0,0 +1,235 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseFile(h) if (INVALID_HANDLE_VALUE != h) { ::CloseHandle(h); h = INVALID_HANDLE_VALUE; }
10#define ReleaseFileHandle(h) if (INVALID_HANDLE_VALUE != h) { ::CloseHandle(h); h = INVALID_HANDLE_VALUE; }
11#define ReleaseFileFindHandle(h) if (INVALID_HANDLE_VALUE != h) { ::FindClose(h); h = INVALID_HANDLE_VALUE; }
12
13#define FILEMAKEVERSION(major, minor, build, revision) static_cast<DWORD64>((static_cast<DWORD64>(major & 0xFFFF) << 48) \
14 | (static_cast<DWORD64>(minor & 0xFFFF) << 32) \
15 | (static_cast<DWORD64>(build & 0xFFFF) << 16) \
16 | (static_cast<DWORD64>(revision & 0xFFFF)))
17
18typedef enum FILE_ARCHITECTURE
19{
20 FILE_ARCHITECTURE_UNKNOWN,
21 FILE_ARCHITECTURE_X86,
22 FILE_ARCHITECTURE_X64,
23 FILE_ARCHITECTURE_IA64,
24} FILE_ARCHITECTURE;
25
26typedef enum FILE_ENCODING
27{
28 FILE_ENCODING_UNSPECIFIED = 0,
29 // TODO: distinguish between non-BOM utf-8 and ANSI in the future?
30 FILE_ENCODING_UTF8,
31 FILE_ENCODING_UTF8_WITH_BOM,
32 FILE_ENCODING_UTF16,
33 FILE_ENCODING_UTF16_WITH_BOM,
34} FILE_ENCODING;
35
36
37LPWSTR DAPI FileFromPath(
38 __in_z LPCWSTR wzPath
39 );
40HRESULT DAPI FileResolvePath(
41 __in_z LPCWSTR wzRelativePath,
42 __out LPWSTR *ppwzFullPath
43 );
44HRESULT DAPI FileStripExtension(
45 __in_z LPCWSTR wzFileName,
46 __out LPWSTR *ppwzFileNameNoExtension
47 );
48HRESULT DAPI FileChangeExtension(
49 __in_z LPCWSTR wzFileName,
50 __in_z LPCWSTR wzNewExtension,
51 __out LPWSTR *ppwzFileNameNewExtension
52 );
53HRESULT DAPI FileAddSuffixToBaseName(
54 __in_z LPCWSTR wzFileName,
55 __in_z LPCWSTR wzSuffix,
56 __out_z LPWSTR* psczNewFileName
57 );
58HRESULT DAPI FileVersionFromString(
59 __in_z LPCWSTR wzVersion,
60 __out DWORD *pdwVerMajor,
61 __out DWORD* pdwVerMinor
62 );
63HRESULT DAPI FileVersionFromStringEx(
64 __in_z LPCWSTR wzVersion,
65 __in DWORD cchVersion,
66 __out DWORD64* pqwVersion
67 );
68HRESULT DAPI FileVersionToStringEx(
69 __in DWORD64 qwVersion,
70 __out LPWSTR* psczVersion
71 );
72HRESULT DAPI FileSetPointer(
73 __in HANDLE hFile,
74 __in DWORD64 dw64Move,
75 __out_opt DWORD64* pdw64NewPosition,
76 __in DWORD dwMoveMethod
77 );
78HRESULT DAPI FileSize(
79 __in_z LPCWSTR pwzFileName,
80 __out LONGLONG* pllSize
81 );
82HRESULT DAPI FileSizeByHandle(
83 __in HANDLE hFile,
84 __out LONGLONG* pllSize
85 );
86BOOL DAPI FileExistsEx(
87 __in_z LPCWSTR wzPath,
88 __out_opt DWORD *pdwAttributes
89 );
90BOOL DAPI FileExistsAfterRestart(
91 __in_z LPCWSTR wzPath,
92 __out_opt DWORD *pdwAttributes
93 );
94HRESULT DAPI FileRemoveFromPendingRename(
95 __in_z LPCWSTR wzPath
96 );
97HRESULT DAPI FileRead(
98 __deref_out_bcount_full(*pcbDest) LPBYTE* ppbDest,
99 __out DWORD* pcbDest,
100 __in_z LPCWSTR wzSrcPath
101 );
102HRESULT DAPI FileReadEx(
103 __deref_out_bcount_full(*pcbDest) LPBYTE* ppbDest,
104 __out DWORD* pcbDest,
105 __in_z LPCWSTR wzSrcPath,
106 __in DWORD dwShareMode
107 );
108HRESULT DAPI FileReadUntil(
109 __deref_out_bcount_full(*pcbDest) LPBYTE* ppbDest,
110 __out_range(<=, cbMaxRead) DWORD* pcbDest,
111 __in_z LPCWSTR wzSrcPath,
112 __in DWORD cbMaxRead
113 );
114HRESULT DAPI FileReadPartial(
115 __deref_out_bcount_full(*pcbDest) LPBYTE* ppbDest,
116 __out_range(<=, cbMaxRead) DWORD* pcbDest,
117 __in_z LPCWSTR wzSrcPath,
118 __in BOOL fSeek,
119 __in DWORD cbStartPosition,
120 __in DWORD cbMaxRead,
121 __in BOOL fPartialOK
122 );
123HRESULT DAPI FileReadPartialEx(
124 __deref_out_bcount_full(*pcbDest) LPBYTE* ppbDest,
125 __out_range(<=, cbMaxRead) DWORD* pcbDest,
126 __in_z LPCWSTR wzSrcPath,
127 __in BOOL fSeek,
128 __in DWORD cbStartPosition,
129 __in DWORD cbMaxRead,
130 __in BOOL fPartialOK,
131 __in DWORD dwShareMode
132 );
133HRESULT DAPI FileWrite(
134 __in_z LPCWSTR pwzFileName,
135 __in DWORD dwFlagsAndAttributes,
136 __in_bcount_opt(cbData) LPCBYTE pbData,
137 __in DWORD cbData,
138 __out_opt HANDLE* pHandle
139 );
140HRESULT DAPI FileWriteHandle(
141 __in HANDLE hFile,
142 __in_bcount_opt(cbData) LPCBYTE pbData,
143 __in DWORD cbData
144 );
145HRESULT DAPI FileCopyUsingHandles(
146 __in HANDLE hSource,
147 __in HANDLE hTarget,
148 __in DWORD64 cbCopy,
149 __out_opt DWORD64* pcbCopied
150 );
151HRESULT DAPI FileEnsureCopy(
152 __in_z LPCWSTR wzSource,
153 __in_z LPCWSTR wzTarget,
154 __in BOOL fOverwrite
155 );
156HRESULT DAPI FileEnsureCopyWithRetry(
157 __in LPCWSTR wzSource,
158 __in LPCWSTR wzTarget,
159 __in BOOL fOverwrite,
160 __in DWORD cRetry,
161 __in DWORD dwWaitMilliseconds
162 );
163HRESULT DAPI FileEnsureMove(
164 __in_z LPCWSTR wzSource,
165 __in_z LPCWSTR wzTarget,
166 __in BOOL fOverwrite,
167 __in BOOL fAllowCopy
168 );
169HRESULT DAPI FileEnsureMoveWithRetry(
170 __in LPCWSTR wzSource,
171 __in LPCWSTR wzTarget,
172 __in BOOL fOverwrite,
173 __in BOOL fAllowCopy,
174 __in DWORD cRetry,
175 __in DWORD dwWaitMilliseconds
176 );
177HRESULT DAPI FileCreateTemp(
178 __in_z LPCWSTR wzPrefix,
179 __in_z LPCWSTR wzExtension,
180 __deref_opt_out_z LPWSTR* ppwzTempFile,
181 __out_opt HANDLE* phTempFile
182 );
183HRESULT DAPI FileCreateTempW(
184 __in_z LPCWSTR wzPrefix,
185 __in_z LPCWSTR wzExtension,
186 __deref_opt_out_z LPWSTR* ppwzTempFile,
187 __out_opt HANDLE* phTempFile
188 );
189HRESULT DAPI FileVersion(
190 __in_z LPCWSTR wzFilename,
191 __out DWORD *pdwVerMajor,
192 __out DWORD* pdwVerMinor
193 );
194HRESULT DAPI FileIsSame(
195 __in_z LPCWSTR wzFile1,
196 __in_z LPCWSTR wzFile2,
197 __out LPBOOL lpfSameFile
198 );
199HRESULT DAPI FileEnsureDelete(
200 __in_z LPCWSTR wzFile
201 );
202HRESULT DAPI FileGetTime(
203 __in_z LPCWSTR wzFile,
204 __out_opt LPFILETIME lpCreationTime,
205 __out_opt LPFILETIME lpLastAccessTime,
206 __out_opt LPFILETIME lpLastWriteTime
207 );
208HRESULT DAPI FileSetTime(
209 __in_z LPCWSTR wzFile,
210 __in_opt const FILETIME *lpCreationTime,
211 __in_opt const FILETIME *lpLastAccessTime,
212 __in_opt const FILETIME *lpLastWriteTime
213 );
214HRESULT DAPI FileResetTime(
215 __in_z LPCWSTR wzFile
216 );
217HRESULT DAPI FileExecutableArchitecture(
218 __in_z LPCWSTR wzFile,
219 __out FILE_ARCHITECTURE *pArchitecture
220 );
221HRESULT DAPI FileToString(
222 __in_z LPCWSTR wzFile,
223 __out LPWSTR *psczString,
224 __out_opt FILE_ENCODING *pfeEncoding
225 );
226HRESULT DAPI FileFromString(
227 __in_z LPCWSTR wzFile,
228 __in DWORD dwFlagsAndAttributes,
229 __in_z LPCWSTR sczString,
230 __in FILE_ENCODING feEncoding
231 );
232
233#ifdef __cplusplus
234}
235#endif
diff --git a/src/dutil/inc/gdiputil.h b/src/dutil/inc/gdiputil.h
new file mode 100644
index 00000000..3708053c
--- /dev/null
+++ b/src/dutil/inc/gdiputil.h
@@ -0,0 +1,38 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#define ExitOnGdipFailure(g, x, s, ...) { x = GdipHresultFromStatus(g); if (FAILED(x)) { Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, s, __VA_ARGS__); goto LExit; } }
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11HRESULT DAPI GdipInitialize(
12 __in const Gdiplus::GdiplusStartupInput* pInput,
13 __out ULONG_PTR* pToken,
14 __out_opt Gdiplus::GdiplusStartupOutput *pOutput
15 );
16
17void DAPI GdipUninitialize(
18 __in ULONG_PTR token
19 );
20
21HRESULT DAPI GdipBitmapFromResource(
22 __in_opt HINSTANCE hinst,
23 __in_z LPCSTR szId,
24 __out Gdiplus::Bitmap **ppBitmap
25 );
26
27HRESULT DAPI GdipBitmapFromFile(
28 __in_z LPCWSTR wzFileName,
29 __out Gdiplus::Bitmap **ppBitmap
30 );
31
32HRESULT DAPI GdipHresultFromStatus(
33 __in Gdiplus::Status gs
34 );
35
36#ifdef __cplusplus
37}
38#endif
diff --git a/src/dutil/inc/guidutil.h b/src/dutil/inc/guidutil.h
new file mode 100644
index 00000000..478a464f
--- /dev/null
+++ b/src/dutil/inc/guidutil.h
@@ -0,0 +1,21 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define GUID_STRING_LENGTH 39
10
11HRESULT DAPI GuidFixedCreate(
12 _Out_z_cap_c_(GUID_STRING_LENGTH) WCHAR* wzGuid
13 );
14
15HRESULT DAPI GuidCreate(
16 __deref_out_z LPWSTR* psczGuid
17 );
18
19#ifdef __cplusplus
20}
21#endif
diff --git a/src/dutil/inc/iis7util.h b/src/dutil/inc/iis7util.h
new file mode 100644
index 00000000..3572b4e9
--- /dev/null
+++ b/src/dutil/inc/iis7util.h
@@ -0,0 +1,222 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9// IIS Config schema names
10#define IIS_CONFIG_ADD L"add"
11#define IIS_CONFIG_ALLOWED L"allowed"
12#define IIS_CONFIG_APPHOST_ROOT L"MACHINE/WEBROOT/APPHOST"
13#define IIS_CONFIG_APPLICATION L"application"
14#define IIS_CONFIG_APPPOOL L"applicationPool"
15#define IIS_CONFIG_APPPOOL_AUTO L"autoStart"
16#define IIS_CONFIG_APPPOOL_SECTION L"system.applicationHost/applicationPools"
17#define IIS_CONFIG_AUTOSTART L"serverAutoStart"
18#define IIS_CONFIG_BINDING L"binding"
19#define IIS_CONFIG_BINDINGINFO L"bindingInformation"
20#define IIS_CONFIG_BINDINGS L"bindings"
21#define IIS_CONFIG_DESC L"description"
22#define IIS_CONFIG_EXECUTABLE L"scriptProcessor"
23#define IIS_CONFIG_ENABLED L"enabled"
24#define IIS_CONFIG_ENABLE32 L"enable32BitAppOnWin64"
25#define IIS_CONFIG_FILEEXT L"fileExtension"
26#define IIS_CONFIG_FILTER L"filter"
27#define IIS_CONFIG_GROUPID L"groupId"
28#define IIS_CONFIG_HEADERS L"customHeaders"
29#define IIS_CONFIG_HTTPERRORS_SECTION L"system.webServer/httpErrors"
30#define IIS_CONFIG_ID L"id"
31#define IIS_CONFIG_ISAPI_SECTION L"system.webServer/isapiFilters"
32#define IIS_CONFIG_HTTPPROTO_SECTION L"system.webServer/httpProtocol"
33#define IIS_CONFIG_LOG_SECTION L"system.applicationHost/log"
34#define IIS_CONFIG_LOG_UTF8 L"logInUTF8"
35#define IIS_CONFIG_LIMITS L"limits"
36#define IIS_CONFIG_PIPELINEMODE L"managedPipelineMode"
37#define IIS_CONFIG_MANAGEDRUNTIMEVERSION L"managedRuntimeVersion"
38#define IIS_CONFIG_WEBLOG L"logFile"
39#define IIS_CONFIG_LOGFORMAT L"logFormat"
40#define IIS_CONFIG_MIMEMAP L"mimeMap"
41#define IIS_CONFIG_MIMETYPE L"mimeType"
42#define IIS_CONFIG_MODULES L"modules"
43#define IIS_CONFIG_NAME L"name"
44#define IIS_CONFIG_PATH L"path"
45#define IIS_CONFIG_PHYSPATH L"physicalPath"
46#define IIS_CONFIG_PROTOCOL L"protocol"
47#define IIS_CONFIG_RESTRICTION_SECTION L"system.webServer/security/isapiCgiRestriction"
48#define IIS_CONFIG_SITE L"site"
49#define IIS_CONFIG_SITE_ID L"id"
50#define IIS_CONFIG_SITES_SECTION L"system.applicationHost/sites"
51#define IIS_CONFIG_CONNECTTIMEOUT L"connectionTimeout"
52#define IIS_CONFIG_VDIR L"virtualDirectory"
53#define IIS_CONFIG_VALUE L"value"
54#define IIS_CONFIG_VERBS L"verb"
55#define IIS_CONFIG_WEBLIMITS_SECTION L"system.applicationHost/webLimits"
56#define IIS_CONFIG_WEBLIMITS_MAXBAND L"maxGlobalBandwidth"
57#define IIS_CONFIG_TRUE L"true"
58#define IIS_CONFIG_FALSE L"false"
59#define IIS_CONFIG_ERROR L"error"
60#define IIS_CONFIG_STATUSCODE L"statusCode"
61#define IIS_CONFIG_SUBSTATUS L"subStatusCode"
62#define IIS_CONFIG_LANGPATH L"prefixLanguageFilePath"
63#define IIS_CONFIG_RESPMODE L"responseMode"
64#define IIS_CONFIG_CLEAR L"clear"
65#define IIS_CONFIG_RECYCLING L"recycling"
66#define IIS_CONFIG_PEROIDRESTART L"periodicRestart"
67#define IIS_CONFIG_TIME L"time"
68#define IIS_CONFIG_REQUESTS L"requests"
69#define IIS_CONFIG_SCHEDULE L"schedule"
70#define IIS_CONFIG_MEMORY L"memory"
71#define IIS_CONFIG_PRIVMEMORY L"privateMemory"
72#define IIS_CONFIG_PROCESSMODEL L"processModel"
73#define IIS_CONFIG_IDLETIMEOUT L"idleTimeout"
74#define IIS_CONFIG_QUEUELENGTH L"queueLength"
75#define IIS_CONFIG_IDENITITYTYPE L"identityType"
76#define IIS_CONFIG_LOCALSYSTEM L"LocalSystem"
77#define IIS_CONFIG_LOCALSERVICE L"LocalService"
78#define IIS_CONFIG_NETWORKSERVICE L"NetworkService"
79#define IIS_CONFIG_SPECIFICUSER L"SpecificUser"
80#define IIS_CONFIG_APPLICATIONPOOLIDENTITY L"ApplicationPoolIdentity"
81#define IIS_CONFIG_USERNAME L"userName"
82#define IIS_CONFIG_PASSWORD L"password"
83#define IIS_CONFIG_CPU L"cpu"
84#define IIS_CONFIG_LIMIT L"limit"
85#define IIS_CONFIG_CPU_ACTION L"action"
86#define IIS_CONFIG_KILLW3WP L"KillW3wp"
87#define IIS_CONFIG_NOACTION L"NoAction"
88#define IIS_CONFIG_RESETINTERVAL L"resetInterval"
89#define IIS_CONFIG_MAXWRKPROCESSES L"maxProcesses"
90#define IIS_CONFIG_HANDLERS_SECTION L"system.webServer/handlers"
91#define IIS_CONFIG_DEFAULTDOC_SECTION L"system.webServer/defaultDocument"
92#define IIS_CONFIG_ASP_SECTION L"system.webServer/asp"
93#define IIS_CONFIG_SCRIPTERROR L"scriptErrorSentToBrowser"
94#define IIS_CONFIG_STATICCONTENT_SECTION L"system.webServer/staticContent"
95#define IIS_CONFIG_HTTPEXPIRES L"httpExpires"
96#define IIS_CONFIG_MAXAGE L"cacheControlMaxAge"
97#define IIS_CONFIG_CLIENTCACHE L"clientCache"
98#define IIS_CONFIG_CACHECONTROLMODE L"cacheControlMode"
99#define IIS_CONFIG_USEMAXAGE L"UseMaxAge"
100#define IIS_CONFIG_USEEXPIRES L"UseExpires"
101#define IIS_CONFIG_CACHECUST L"cacheControlCustom"
102#define IIS_CONFIG_ASP_SECTION L"system.webServer/asp"
103#define IIS_CONFIG_SESSION L"session"
104#define IIS_CONFIG_ALLOWSTATE L"allowSessionState"
105#define IIS_CONFIG_TIMEOUT L"timeout"
106#define IIS_CONFIG_BUFFERING L"bufferingOn"
107#define IIS_CONFIG_PARENTPATHS L"enableParentPaths"
108#define IIS_CONFIG_SCRIPTLANG L"scriptLanguage"
109#define IIS_CONFIG_SCRIPTTIMEOUT L"scriptTimeout"
110#define IIS_CONFIG_LIMITS L"limits"
111#define IIS_CONFIG_ALLOWDEBUG L"appAllowDebugging"
112#define IIS_CONFIG_ALLOWCLIENTDEBUG L"appAllowClientDebug"
113#define IIS_CONFIG_CERTIFICATEHASH L"certificateHash"
114#define IIS_CONFIG_CERTIFICATESTORENAME L"certificateStoreName"
115#define IIS_CONFIG_HTTPLOGGING_SECTION L"system.webServer/httpLogging"
116#define IIS_CONFIG_DONTLOG L"dontLog"
117
118typedef BOOL (CALLBACK* ENUMAPHOSTELEMENTPROC)(IAppHostElement*, LPVOID);
119typedef BOOL (CALLBACK* VARIANTCOMPARATORPROC)(VARIANT*, VARIANT*);
120
121HRESULT DAPI Iis7PutPropertyVariant(
122 __in IAppHostElement *pElement,
123 __in LPCWSTR wzPropName,
124 __in VARIANT vtPut
125 );
126
127HRESULT DAPI Iis7PutPropertyInteger(
128 __in IAppHostElement *pElement,
129 __in LPCWSTR wzPropName,
130 __in DWORD dValue
131 );
132
133HRESULT DAPI Iis7PutPropertyString(
134 __in IAppHostElement *pElement,
135 __in LPCWSTR wzPropName,
136 __in LPCWSTR wzString
137 );
138
139HRESULT DAPI Iis7PutPropertyBool(
140 __in IAppHostElement *pElement,
141 __in LPCWSTR wzPropName,
142 __in BOOL fValue);
143
144HRESULT DAPI Iis7GetPropertyVariant(
145 __in IAppHostElement *pElement,
146 __in LPCWSTR wzPropName,
147 __in VARIANT* vtGet
148 );
149
150HRESULT DAPI Iis7GetPropertyString(
151 __in IAppHostElement *pElement,
152 __in LPCWSTR wzPropName,
153 __in LPWSTR* psczGet
154 );
155
156struct IIS7_APPHOSTELEMENTCOMPARISON
157{
158 LPCWSTR sczElementName;
159 LPCWSTR sczAttributeName;
160 VARIANT* pvAttributeValue;
161 VARIANTCOMPARATORPROC pComparator;
162};
163
164BOOL DAPI Iis7IsMatchingAppHostElement(
165 __in IAppHostElement *pElement,
166 __in IIS7_APPHOSTELEMENTCOMPARISON* pComparison
167 );
168
169HRESULT DAPI Iis7FindAppHostElementString(
170 __in IAppHostElementCollection *pCollection,
171 __in LPCWSTR wzElementName,
172 __in LPCWSTR wzAttributeName,
173 __in LPCWSTR wzAttributeValue,
174 __out IAppHostElement** ppElement,
175 __out DWORD* pdwIndex
176 );
177
178HRESULT DAPI Iis7FindAppHostElementPath(
179 __in IAppHostElementCollection *pCollection,
180 __in LPCWSTR wzElementName,
181 __in LPCWSTR wzAttributeName,
182 __in LPCWSTR wzAttributeValue,
183 __out IAppHostElement** ppElement,
184 __out DWORD* pdwIndex
185 );
186
187HRESULT DAPI Iis7FindAppHostElementInteger(
188 __in IAppHostElementCollection *pCollection,
189 __in LPCWSTR wzElementName,
190 __in LPCWSTR wzAttributeName,
191 __in DWORD dwAttributeValue,
192 __out IAppHostElement** ppElement,
193 __out DWORD* pdwIndex
194 );
195
196HRESULT DAPI Iis7FindAppHostElementVariant(
197 __in IAppHostElementCollection *pCollection,
198 __in LPCWSTR wzElementName,
199 __in LPCWSTR wzAttributeName,
200 __in VARIANT* pvAttributeValue,
201 __out IAppHostElement** ppElement,
202 __out DWORD* pdwIndex
203 );
204
205HRESULT DAPI Iis7EnumAppHostElements(
206 __in IAppHostElementCollection *pCollection,
207 __in ENUMAPHOSTELEMENTPROC pCallback,
208 __in LPVOID pContext,
209 __out IAppHostElement** ppElement,
210 __out DWORD* pdwIndex
211 );
212
213HRESULT DAPI Iis7FindAppHostMethod(
214 __in IAppHostMethodCollection *pCollection,
215 __in LPCWSTR wzMethodName,
216 __out IAppHostMethod** ppMethod,
217 __out DWORD* pdwIndex
218 );
219
220#ifdef __cplusplus
221}
222#endif
diff --git a/src/dutil/inc/inetutil.h b/src/dutil/inc/inetutil.h
new file mode 100644
index 00000000..4cbf510b
--- /dev/null
+++ b/src/dutil/inc/inetutil.h
@@ -0,0 +1,39 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseInternet(h) if (h) { ::InternetCloseHandle(h); h = NULL; }
10#define ReleaseNullInternet(h) if (h) { ::InternetCloseHandle(h); h = NULL; }
11
12
13// functions
14HRESULT DAPI InternetGetSizeByHandle(
15 __in HINTERNET hiFile,
16 __out LONGLONG* pllSize
17 );
18
19HRESULT DAPI InternetGetCreateTimeByHandle(
20 __in HINTERNET hiFile,
21 __out LPFILETIME pft
22 );
23
24HRESULT DAPI InternetQueryInfoString(
25 __in HINTERNET h,
26 __in DWORD dwInfo,
27 __deref_out_z LPWSTR* psczValue
28 );
29
30HRESULT DAPI InternetQueryInfoNumber(
31 __in HINTERNET h,
32 __in DWORD dwInfo,
33 __out LONG* plInfo
34 );
35
36#ifdef __cplusplus
37}
38#endif
39
diff --git a/src/dutil/inc/iniutil.h b/src/dutil/inc/iniutil.h
new file mode 100644
index 00000000..d5b50c17
--- /dev/null
+++ b/src/dutil/inc/iniutil.h
@@ -0,0 +1,79 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseIni(ih) if (ih) { IniUninitialize(ih); }
10#define ReleaseNullIni(ih) if (ih) { IniUninitialize(ih); ih = NULL; }
11
12typedef void* INI_HANDLE;
13typedef const void* C_INI_HANDLE;
14
15extern const int INI_HANDLE_BYTES;
16
17struct INI_VALUE
18{
19 LPCWSTR wzName;
20 LPCWSTR wzValue;
21
22 DWORD dwLineNumber;
23};
24
25HRESULT DAPI IniInitialize(
26 __out_bcount(INI_HANDLE_BYTES) INI_HANDLE* piHandle
27 );
28void DAPI IniUninitialize(
29 __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle
30 );
31HRESULT DAPI IniSetOpenTag(
32 __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
33 __in_z_opt LPCWSTR wzOpenTagPrefix,
34 __in_z_opt LPCWSTR wzOpenTagPostfix
35 );
36HRESULT DAPI IniSetValueStyle(
37 __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
38 __in_z_opt LPCWSTR wzValuePrefix,
39 __in_z_opt LPCWSTR wzValueSeparator
40 );
41HRESULT DAPI IniSetValueSeparatorException(
42 __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
43 __in_z LPCWSTR wzValueNamePrefix
44 );
45HRESULT DAPI IniSetCommentStyle(
46 __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
47 __in_z_opt LPCWSTR wzLinePrefix
48 );
49HRESULT DAPI IniParse(
50 __inout_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
51 __in LPCWSTR wzPath,
52 __out_opt FILE_ENCODING *pfeEncodingFound
53 );
54// Gets the full value array, this includes values that may have been deleted
55// (their value will be NULL)
56HRESULT DAPI IniGetValueList(
57 __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
58 __deref_out_ecount_opt(pcValues) INI_VALUE** prgivValues,
59 __out DWORD *pcValues
60 );
61HRESULT DAPI IniGetValue(
62 __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
63 __in LPCWSTR wzValueName,
64 __deref_out_z LPWSTR* psczValue
65 );
66HRESULT DAPI IniSetValue(
67 __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
68 __in LPCWSTR wzValueName,
69 __in_z_opt LPCWSTR wzValue
70 );
71HRESULT DAPI IniWriteFile(
72 __in_bcount(INI_HANDLE_BYTES) INI_HANDLE piHandle,
73 __in_z_opt LPCWSTR wzPath,
74 __in FILE_ENCODING feOverrideEncoding
75 );
76
77#ifdef __cplusplus
78}
79#endif
diff --git a/src/dutil/inc/jsonutil.h b/src/dutil/inc/jsonutil.h
new file mode 100644
index 00000000..b05e9970
--- /dev/null
+++ b/src/dutil/inc/jsonutil.h
@@ -0,0 +1,112 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9typedef enum JSON_TOKEN
10{
11 JSON_TOKEN_NONE,
12 JSON_TOKEN_ARRAY_START,
13 JSON_TOKEN_ARRAY_VALUE,
14 JSON_TOKEN_ARRAY_END,
15 JSON_TOKEN_OBJECT_START,
16 JSON_TOKEN_OBJECT_KEY,
17 JSON_TOKEN_OBJECT_VALUE,
18 JSON_TOKEN_OBJECT_END,
19 JSON_TOKEN_VALUE,
20} JSON_TOKEN;
21
22typedef struct _JSON_VALUE
23{
24} JSON_VALUE;
25
26typedef struct _JSON_READER
27{
28 CRITICAL_SECTION cs;
29 LPWSTR sczJson;
30
31 LPWSTR pwz;
32 JSON_TOKEN token;
33} JSON_READER;
34
35typedef struct _JSON_WRITER
36{
37 CRITICAL_SECTION cs;
38 LPWSTR sczJson;
39
40 JSON_TOKEN* rgTokenStack;
41 DWORD cTokens;
42 DWORD cMaxTokens;
43} JSON_WRITER;
44
45
46DAPI_(HRESULT) JsonInitializeReader(
47 __in_z LPCWSTR wzJson,
48 __in JSON_READER* pReader
49 );
50
51DAPI_(void) JsonUninitializeReader(
52 __in JSON_READER* pReader
53 );
54
55DAPI_(HRESULT) JsonReadNext(
56 __in JSON_READER* pReader,
57 __out JSON_TOKEN* pToken,
58 __out JSON_VALUE* pValue
59 );
60
61DAPI_(HRESULT) JsonReadValue(
62 __in JSON_READER* pReader,
63 __in JSON_VALUE* pValue
64 );
65
66DAPI_(HRESULT) JsonInitializeWriter(
67 __in JSON_WRITER* pWriter
68 );
69
70DAPI_(void) JsonUninitializeWriter(
71 __in JSON_WRITER* pWriter
72 );
73
74DAPI_(HRESULT) JsonWriteBool(
75 __in JSON_WRITER* pWriter,
76 __in BOOL fValue
77 );
78
79DAPI_(HRESULT) JsonWriteNumber(
80 __in JSON_WRITER* pWriter,
81 __in DWORD dwValue
82 );
83
84DAPI_(HRESULT) JsonWriteString(
85 __in JSON_WRITER* pWriter,
86 __in_z LPCWSTR wzValue
87 );
88
89DAPI_(HRESULT) JsonWriteArrayStart(
90 __in JSON_WRITER* pWriter
91 );
92
93DAPI_(HRESULT) JsonWriteArrayEnd(
94 __in JSON_WRITER* pWriter
95 );
96
97DAPI_(HRESULT) JsonWriteObjectStart(
98 __in JSON_WRITER* pWriter
99 );
100
101DAPI_(HRESULT) JsonWriteObjectKey(
102 __in JSON_WRITER* pWriter,
103 __in_z LPCWSTR wzKey
104 );
105
106DAPI_(HRESULT) JsonWriteObjectEnd(
107 __in JSON_WRITER* pWriter
108 );
109
110#ifdef __cplusplus
111}
112#endif
diff --git a/src/dutil/inc/locutil.h b/src/dutil/inc/locutil.h
new file mode 100644
index 00000000..38ddda20
--- /dev/null
+++ b/src/dutil/inc/locutil.h
@@ -0,0 +1,120 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9struct LOC_STRING
10{
11 LPWSTR wzId;
12 LPWSTR wzText;
13 BOOL bOverridable;
14};
15
16const int LOC_CONTROL_NOT_SET = INT_MAX;
17
18struct LOC_CONTROL
19{
20 LPWSTR wzControl;
21 int nX;
22 int nY;
23 int nWidth;
24 int nHeight;
25 LPWSTR wzText;
26};
27
28const int WIX_LOCALIZATION_LANGUAGE_NOT_SET = INT_MAX;
29
30struct WIX_LOCALIZATION
31{
32 DWORD dwLangId;
33
34 DWORD cLocStrings;
35 LOC_STRING* rgLocStrings;
36
37 DWORD cLocControls;
38 LOC_CONTROL* rgLocControls;
39};
40
41/********************************************************************
42 LocProbeForFile - Searches for a localization file on disk.
43
44*******************************************************************/
45HRESULT DAPI LocProbeForFile(
46 __in_z LPCWSTR wzBasePath,
47 __in_z LPCWSTR wzLocFileName,
48 __in_z_opt LPCWSTR wzLanguage,
49 __inout LPWSTR* psczPath
50 );
51
52/********************************************************************
53 LocLoadFromFile - Loads a localization file
54
55*******************************************************************/
56HRESULT DAPI LocLoadFromFile(
57 __in_z LPCWSTR wzWxlFile,
58 __out WIX_LOCALIZATION** ppWixLoc
59 );
60
61/********************************************************************
62 LocLoadFromResource - loads a localization file from a module's data
63 resource.
64
65 NOTE: The resource data must be UTF-8 encoded.
66*******************************************************************/
67HRESULT DAPI LocLoadFromResource(
68 __in HMODULE hModule,
69 __in_z LPCSTR szResource,
70 __out WIX_LOCALIZATION** ppWixLoc
71 );
72
73/********************************************************************
74 LocFree - free memory allocated when loading a localization file
75
76*******************************************************************/
77void DAPI LocFree(
78 __in_opt WIX_LOCALIZATION* pWixLoc
79 );
80
81/********************************************************************
82 LocLocalizeString - replace any #(loc.id) in a string with the
83 correct sub string
84*******************************************************************/
85HRESULT DAPI LocLocalizeString(
86 __in const WIX_LOCALIZATION* pWixLoc,
87 __inout LPWSTR* psczInput
88 );
89
90/********************************************************************
91 LocGetControl - returns a control's localization information
92*******************************************************************/
93HRESULT DAPI LocGetControl(
94 __in const WIX_LOCALIZATION* pWixLoc,
95 __in_z LPCWSTR wzId,
96 __out LOC_CONTROL** ppLocControl
97 );
98
99/********************************************************************
100LocGetString - returns a string's localization information
101*******************************************************************/
102extern "C" HRESULT DAPI LocGetString(
103 __in const WIX_LOCALIZATION* pWixLoc,
104 __in_z LPCWSTR wzId,
105 __out LOC_STRING** ppLocString
106 );
107
108/********************************************************************
109LocAddString - adds a localization string
110*******************************************************************/
111extern "C" HRESULT DAPI LocAddString(
112 __in WIX_LOCALIZATION* pWixLoc,
113 __in_z LPCWSTR wzId,
114 __in_z LPCWSTR wzLocString,
115 __in BOOL bOverridable
116 );
117
118#ifdef __cplusplus
119}
120#endif
diff --git a/src/dutil/inc/logutil.h b/src/dutil/inc/logutil.h
new file mode 100644
index 00000000..ee0cd065
--- /dev/null
+++ b/src/dutil/inc/logutil.h
@@ -0,0 +1,190 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define LogExitOnFailure(x, i, f, ...) if (FAILED(x)) { LogErrorId(x, i, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
10
11#define LogExitOnRootFailure(x, i, f, ...) if (FAILED(x)) { LogErrorId(x, i, __VA_ARGS__); Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
12
13typedef HRESULT (DAPI *PFN_LOGSTRINGWORKRAW)(
14 __in_z LPCSTR szString,
15 __in_opt LPVOID pvContext
16 );
17
18// enums
19
20// structs
21
22// functions
23BOOL DAPI IsLogInitialized();
24
25BOOL DAPI IsLogOpen();
26
27void DAPI LogInitialize(
28 __in HMODULE hModule
29 );
30
31HRESULT DAPI LogOpen(
32 __in_z_opt LPCWSTR wzDirectory,
33 __in_z LPCWSTR wzLog,
34 __in_z_opt LPCWSTR wzPostfix,
35 __in_z_opt LPCWSTR wzExt,
36 __in BOOL fAppend,
37 __in BOOL fHeader,
38 __out_z_opt LPWSTR* psczLogPath
39 );
40
41void DAPI LogDisable();
42
43void DAPI LogRedirect(
44 __in_opt PFN_LOGSTRINGWORKRAW vpfLogStringWorkRaw,
45 __in_opt LPVOID pvContext
46 );
47
48HRESULT DAPI LogRename(
49 __in_z LPCWSTR wzNewPath
50 );
51
52void DAPI LogClose(
53 __in BOOL fFooter
54 );
55
56void DAPI LogUninitialize(
57 __in BOOL fFooter
58 );
59
60BOOL DAPI LogIsOpen();
61
62HRESULT DAPI LogSetSpecialParams(
63 __in_z_opt LPCWSTR wzSpecialBeginLine,
64 __in_z_opt LPCWSTR wzSpecialAfterTimeStamp,
65 __in_z_opt LPCWSTR wzSpecialEndLine
66 );
67
68REPORT_LEVEL DAPI LogSetLevel(
69 __in REPORT_LEVEL rl,
70 __in BOOL fLogChange
71 );
72
73REPORT_LEVEL DAPI LogGetLevel();
74
75HRESULT DAPI LogGetPath(
76 __out_ecount_z(cchLogPath) LPWSTR pwzLogPath,
77 __in DWORD cchLogPath
78 );
79
80HANDLE DAPI LogGetHandle();
81
82HRESULT DAPIV LogString(
83 __in REPORT_LEVEL rl,
84 __in_z __format_string LPCSTR szFormat,
85 ...
86 );
87
88HRESULT DAPI LogStringArgs(
89 __in REPORT_LEVEL rl,
90 __in_z __format_string LPCSTR szFormat,
91 __in va_list args
92 );
93
94HRESULT DAPIV LogStringLine(
95 __in REPORT_LEVEL rl,
96 __in_z __format_string LPCSTR szFormat,
97 ...
98 );
99
100HRESULT DAPI LogStringLineArgs(
101 __in REPORT_LEVEL rl,
102 __in_z __format_string LPCSTR szFormat,
103 __in va_list args
104 );
105
106HRESULT DAPI LogIdModuleArgs(
107 __in REPORT_LEVEL rl,
108 __in DWORD dwLogId,
109 __in_opt HMODULE hModule,
110 __in va_list args
111 );
112
113/*
114 * Wraps LogIdModuleArgs, so inline to save the function call
115 */
116
117inline HRESULT LogId(
118 __in REPORT_LEVEL rl,
119 __in DWORD dwLogId,
120 ...
121 )
122{
123 HRESULT hr = S_OK;
124 va_list args;
125
126 va_start(args, dwLogId);
127 hr = LogIdModuleArgs(rl, dwLogId, NULL, args);
128 va_end(args);
129
130 return hr;
131}
132
133
134/*
135 * Wraps LogIdModuleArgs, so inline to save the function call
136 */
137
138inline HRESULT LogIdArgs(
139 __in REPORT_LEVEL rl,
140 __in DWORD dwLogId,
141 __in va_list args
142 )
143{
144 return LogIdModuleArgs(rl, dwLogId, NULL, args);
145}
146
147HRESULT DAPIV LogErrorString(
148 __in HRESULT hrError,
149 __in_z __format_string LPCSTR szFormat,
150 ...
151 );
152
153HRESULT DAPI LogErrorStringArgs(
154 __in HRESULT hrError,
155 __in_z __format_string LPCSTR szFormat,
156 __in va_list args
157 );
158
159HRESULT DAPI LogErrorIdModule(
160 __in HRESULT hrError,
161 __in DWORD dwLogId,
162 __in_opt HMODULE hModule,
163 __in_z_opt LPCWSTR wzString1,
164 __in_z_opt LPCWSTR wzString2,
165 __in_z_opt LPCWSTR wzString3
166 );
167
168inline HRESULT LogErrorId(
169 __in HRESULT hrError,
170 __in DWORD dwLogId,
171 __in_z_opt LPCWSTR wzString1 = NULL,
172 __in_z_opt LPCWSTR wzString2 = NULL,
173 __in_z_opt LPCWSTR wzString3 = NULL
174 )
175{
176 return LogErrorIdModule(hrError, dwLogId, NULL, wzString1, wzString2, wzString3);
177}
178
179HRESULT DAPI LogHeader();
180
181HRESULT DAPI LogFooter();
182
183HRESULT LogStringWorkRaw(
184 __in_z LPCSTR szLogData
185 );
186
187#ifdef __cplusplus
188}
189#endif
190
diff --git a/src/dutil/inc/memutil.h b/src/dutil/inc/memutil.h
new file mode 100644
index 00000000..93e53228
--- /dev/null
+++ b/src/dutil/inc/memutil.h
@@ -0,0 +1,80 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseMem(p) if (p) { MemFree(p); }
10#define ReleaseNullMem(p) if (p) { MemFree(p); p = NULL; }
11
12HRESULT DAPI MemInitialize();
13void DAPI MemUninitialize();
14
15LPVOID DAPI MemAlloc(
16 __in SIZE_T cbSize,
17 __in BOOL fZero
18 );
19LPVOID DAPI MemReAlloc(
20 __in LPVOID pv,
21 __in SIZE_T cbSize,
22 __in BOOL fZero
23 );
24HRESULT DAPI MemReAllocSecure(
25 __in LPVOID pv,
26 __in SIZE_T cbSize,
27 __in BOOL fZero,
28 __deref_out LPVOID* ppvNew
29 );
30HRESULT DAPI MemAllocArray(
31 __inout LPVOID* ppvArray,
32 __in SIZE_T cbArrayType,
33 __in DWORD dwItemCount
34 );
35HRESULT DAPI MemReAllocArray(
36 __inout LPVOID* ppvArray,
37 __in DWORD cArray,
38 __in SIZE_T cbArrayType,
39 __in DWORD dwNewItemCount
40 );
41HRESULT DAPI MemEnsureArraySize(
42 __deref_out_bcount(cArray * cbArrayType) LPVOID* ppvArray,
43 __in DWORD cArray,
44 __in SIZE_T cbArrayType,
45 __in DWORD dwGrowthCount
46 );
47HRESULT DAPI MemInsertIntoArray(
48 __deref_out_bcount((cExistingArray + cInsertItems) * cbArrayType) LPVOID* ppvArray,
49 __in DWORD dwInsertIndex,
50 __in DWORD cInsertItems,
51 __in DWORD cExistingArray,
52 __in SIZE_T cbArrayType,
53 __in DWORD dwGrowthCount
54 );
55void DAPI MemRemoveFromArray(
56 __inout_bcount((cExistingArray) * cbArrayType) LPVOID pvArray,
57 __in DWORD dwRemoveIndex,
58 __in DWORD cRemoveItems,
59 __in DWORD cExistingArray,
60 __in SIZE_T cbArrayType,
61 __in BOOL fPreserveOrder
62 );
63void DAPI MemArraySwapItems(
64 __inout_bcount((cExistingArray) * cbArrayType) LPVOID pvArray,
65 __in DWORD dwIndex1,
66 __in DWORD dwIndex2,
67 __in SIZE_T cbArrayType
68 );
69
70HRESULT DAPI MemFree(
71 __in LPVOID pv
72 );
73SIZE_T DAPI MemSize(
74 __in LPCVOID pv
75 );
76
77#ifdef __cplusplus
78}
79#endif
80
diff --git a/src/dutil/inc/metautil.h b/src/dutil/inc/metautil.h
new file mode 100644
index 00000000..31f9ff5c
--- /dev/null
+++ b/src/dutil/inc/metautil.h
@@ -0,0 +1,52 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <iadmw.h>
6#include <iiscnfg.h>
7#include <iwamreg.h>
8#include <mddefw.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14// structs
15
16// prototypes
17HRESULT DAPI MetaFindWebBase(
18 __in IMSAdminBaseW* piMetabase,
19 __in_z LPCWSTR wzIP,
20 __in int iPort,
21 __in_z LPCWSTR wzHeader,
22 __in BOOL fSecure,
23 __out_ecount(cchWebBase) LPWSTR wzWebBase,
24 __in DWORD cchWebBase
25 );
26HRESULT DAPI MetaFindFreeWebBase(
27 __in IMSAdminBaseW* piMetabase,
28 __out_ecount(cchWebBase) LPWSTR wzWebBase,
29 __in DWORD cchWebBase
30 );
31
32HRESULT DAPI MetaOpenKey(
33 __in IMSAdminBaseW* piMetabase,
34 __in METADATA_HANDLE mhKey,
35 __in_z LPCWSTR wzKey,
36 __in DWORD dwAccess,
37 __in DWORD cRetries,
38 __out METADATA_HANDLE* pmh
39 );
40HRESULT DAPI MetaGetValue(
41 __in IMSAdminBaseW* piMetabase,
42 __in METADATA_HANDLE mhKey,
43 __in_z LPCWSTR wzKey,
44 __inout METADATA_RECORD* pmr
45 );
46void DAPI MetaFreeValue(
47 __in METADATA_RECORD* pmr
48 );
49
50#ifdef __cplusplus
51}
52#endif
diff --git a/src/dutil/inc/monutil.h b/src/dutil/inc/monutil.h
new file mode 100644
index 00000000..f644e205
--- /dev/null
+++ b/src/dutil/inc/monutil.h
@@ -0,0 +1,108 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseMon(mh) if (mh) { MonDestroy(mh); }
10#define ReleaseNullMon(mh) if (mh) { MonDestroy(mh); mh = NULL; }
11
12typedef void* MON_HANDLE;
13typedef const void* C_MON_HANDLE;
14
15// Defined in regutil.h
16enum REG_KEY_BITNESS;
17
18extern const int MON_HANDLE_BYTES;
19
20// Note: callbacks must be implemented in a thread-safe manner. They will be called asynchronously by a MonUtil-spawned thread.
21// They must also be written to return as soon as possible - they are called from the waiter thread
22typedef void (*PFN_MONGENERAL)(
23 __in HRESULT hr,
24 __in_opt LPVOID pvContext
25 );
26// This callback is not specific to any wait - it will notify client of any drive status changes, such as removable drive insertion / removal
27typedef void (*PFN_MONDRIVESTATUS)(
28 __in WCHAR chDrive,
29 __in BOOL fArriving,
30 __in_opt LPVOID pvContext
31 );
32// Note if these fire with a failed result it means an error has occurred with the wait, and so the wait will stay in the list and be retried. When waits start succeeding again,
33// MonUtil will notify of changes, because it may have not noticed changes during the interval for which the wait had failed. This behavior can result in false positive notifications,
34// so all consumers of MonUtil should be designed with this in mind.
35typedef void (*PFN_MONDIRECTORY)(
36 __in HRESULT hr,
37 __in_z LPCWSTR wzPath,
38 __in BOOL fRecursive,
39 __in_opt LPVOID pvContext,
40 __in_opt LPVOID pvDirectoryContext
41 );
42typedef void (*PFN_MONREGKEY)(
43 __in HRESULT hr,
44 __in HKEY hkRoot,
45 __in_z LPCWSTR wzSubKey,
46 __in REG_KEY_BITNESS kbKeyBitness,
47 __in BOOL fRecursive,
48 __in_opt LPVOID pvContext,
49 __in_opt LPVOID pvRegKeyContext
50 );
51
52// Silence period allows you to avoid lots of notifications when a lot of writes are going on in a directory
53// MonUtil will wait until the directory has been "silent" for at least dwSilencePeriodInMs milliseconds
54// The drawback to setting this to a value higher than zero is that even single write notifications
55// are delayed by this amount
56HRESULT DAPI MonCreate(
57 __out_bcount(MON_HANDLE_BYTES) MON_HANDLE *pHandle,
58 __in PFN_MONGENERAL vpfMonGeneral,
59 __in_opt PFN_MONDRIVESTATUS vpfMonDriveStatus,
60 __in_opt PFN_MONDIRECTORY vpfMonDirectory,
61 __in_opt PFN_MONREGKEY vpfMonRegKey,
62 __in_opt LPVOID pvContext
63 );
64// Don't add multiple identical waits! Not only is it wasteful and will cause multiple fires for the exact same change, it will also
65// result in slightly odd behavior when you remove a duplicated wait (removing a wait may or may not remove multiple waits)
66// This is due to the way coordinator thread and waiter threads handle removing, and while it is possible to solve, doing so would complicate the code.
67// So instead, de-dupe your wait requests before sending them to MonUtil.
68// Special notes for network waits: MonUtil can send false positive notifications (i.e. notifications when nothing had changed) if connection
69// to the share is lost and reconnected, because MonUtil can't know for sure whether changes occurred while the connection was lost.
70// Also, MonUtil will very every 20 minutes retry even successful network waits, because the underlying Win32 API cannot notify us if a remote server
71// had its network cable unplugged or similar sudden failure. When we retry the successful network waits, we will also send a false positive notification,
72// because it's impossible for MonUtil to detect if we're reconnecting to a server that had died and come back to life, or if we're reconnecting to a server that had
73// been up all along. For both of the above reasons, clients of MonUtil must be written to do very, very little work in the case of false positive network waits.
74HRESULT DAPI MonAddDirectory(
75 __in_bcount(MON_HANDLE_BYTES) MON_HANDLE handle,
76 __in_z LPCWSTR wzPath,
77 __in BOOL fRecursive,
78 __in DWORD dwSilencePeriodInMs,
79 __in_opt LPVOID pvDirectoryContext
80 );
81HRESULT DAPI MonAddRegKey(
82 __in_bcount(MON_HANDLE_BYTES) MON_HANDLE handle,
83 __in HKEY hkRoot,
84 __in_z LPCWSTR wzSubKey,
85 __in REG_KEY_BITNESS kbKeyBitness,
86 __in BOOL fRecursive,
87 __in DWORD dwSilencePeriodInMs,
88 __in_opt LPVOID pvRegKeyContext
89 );
90HRESULT DAPI MonRemoveDirectory(
91 __in_bcount(MON_HANDLE_BYTES) MON_HANDLE handle,
92 __in_z LPCWSTR wzPath,
93 __in BOOL fRecursive
94 );
95HRESULT DAPI MonRemoveRegKey(
96 __in_bcount(MON_HANDLE_BYTES) MON_HANDLE handle,
97 __in HKEY hkRoot,
98 __in_z LPCWSTR wzSubKey,
99 __in REG_KEY_BITNESS kbKeyBitness,
100 __in BOOL fRecursive
101 );
102void DAPI MonDestroy(
103 __in_bcount(MON_HANDLE_BYTES) MON_HANDLE handle
104 );
105
106#ifdef __cplusplus
107}
108#endif
diff --git a/src/dutil/inc/osutil.h b/src/dutil/inc/osutil.h
new file mode 100644
index 00000000..01f8d9cf
--- /dev/null
+++ b/src/dutil/inc/osutil.h
@@ -0,0 +1,39 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9typedef enum OS_VERSION
10{
11 OS_VERSION_UNKNOWN,
12 OS_VERSION_WINNT,
13 OS_VERSION_WIN2000,
14 OS_VERSION_WINXP,
15 OS_VERSION_WIN2003,
16 OS_VERSION_VISTA,
17 OS_VERSION_WIN2008,
18 OS_VERSION_WIN7,
19 OS_VERSION_WIN2008_R2,
20 OS_VERSION_FUTURE
21} OS_VERSION;
22
23void DAPI OsGetVersion(
24 __out OS_VERSION* pVersion,
25 __out DWORD* pdwServicePack
26 );
27HRESULT DAPI OsCouldRunPrivileged(
28 __out BOOL* pfPrivileged
29 );
30HRESULT DAPI OsIsRunningPrivileged(
31 __out BOOL* pfPrivileged
32 );
33HRESULT DAPI OsIsUacEnabled(
34 __out BOOL* pfUacEnabled
35 );
36
37#ifdef __cplusplus
38}
39#endif
diff --git a/src/dutil/inc/pathutil.h b/src/dutil/inc/pathutil.h
new file mode 100644
index 00000000..76798172
--- /dev/null
+++ b/src/dutil/inc/pathutil.h
@@ -0,0 +1,232 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9typedef enum PATH_EXPAND
10{
11 PATH_EXPAND_ENVIRONMENT = 0x0001,
12 PATH_EXPAND_FULLPATH = 0x0002,
13} PATH_EXPAND;
14
15
16/*******************************************************************
17 PathCommandLineAppend - appends a command line argument on to a
18 string such that ::CommandLineToArgv() will shred them correctly
19 (i.e. quote arguments with spaces in them).
20********************************************************************/
21DAPI_(HRESULT) PathCommandLineAppend(
22 __deref_out_z LPWSTR* psczCommandLine,
23 __in_z LPCWSTR wzArgument
24 );
25
26/*******************************************************************
27 PathFile - returns a pointer to the file part of the path.
28********************************************************************/
29DAPI_(LPWSTR) PathFile(
30 __in_z LPCWSTR wzPath
31 );
32
33/*******************************************************************
34 PathExtension - returns a pointer to the extension part of the path
35 (including the dot).
36********************************************************************/
37DAPI_(LPCWSTR) PathExtension(
38 __in_z LPCWSTR wzPath
39 );
40
41/*******************************************************************
42 PathGetDirectory - extracts the directory from a path.
43********************************************************************/
44DAPI_(HRESULT) PathGetDirectory(
45 __in_z LPCWSTR wzPath,
46 __out LPWSTR *psczDirectory
47 );
48
49/*******************************************************************
50 PathExpand - gets the full path to a file resolving environment
51 variables along the way.
52********************************************************************/
53DAPI_(HRESULT) PathExpand(
54 __out LPWSTR *psczFullPath,
55 __in_z LPCWSTR wzRelativePath,
56 __in DWORD dwResolveFlags
57 );
58
59/*******************************************************************
60 PathPrefix - prefixes a full path with \\?\ or \\?\UNC as
61 appropriate.
62********************************************************************/
63DAPI_(HRESULT) PathPrefix(
64 __inout LPWSTR *psczFullPath
65 );
66
67/*******************************************************************
68 PathFixedBackslashTerminate - appends a \ if path does not have it
69 already, but fails if the buffer is
70 insufficient.
71********************************************************************/
72DAPI_(HRESULT) PathFixedBackslashTerminate(
73 __inout_ecount_z(cchPath) LPWSTR wzPath,
74 __in DWORD_PTR cchPath
75 );
76
77/*******************************************************************
78 PathBackslashTerminate - appends a \ if path does not have it
79 already.
80********************************************************************/
81DAPI_(HRESULT) PathBackslashTerminate(
82 __inout LPWSTR* psczPath
83 );
84
85/*******************************************************************
86 PathForCurrentProcess - gets the full path to the currently executing
87 process or (optionally) a module inside the process.
88********************************************************************/
89DAPI_(HRESULT) PathForCurrentProcess(
90 __inout LPWSTR *psczFullPath,
91 __in_opt HMODULE hModule
92 );
93
94/*******************************************************************
95 PathRelativeToModule - gets the name of a file in the same
96 directory as the current process or (optionally) a module inside
97 the process
98********************************************************************/
99DAPI_(HRESULT) PathRelativeToModule(
100 __inout LPWSTR *psczFullPath,
101 __in_opt LPCWSTR wzFileName,
102 __in_opt HMODULE hModule
103 );
104
105/*******************************************************************
106 PathCreateTempFile
107
108 Note: if wzDirectory is null, ::GetTempPath() will be used instead.
109 if wzFileNameTemplate is null, GetTempFileName() will be used instead.
110*******************************************************************/
111DAPI_(HRESULT) PathCreateTempFile(
112 __in_opt LPCWSTR wzDirectory,
113 __in_opt __format_string LPCWSTR wzFileNameTemplate,
114 __in DWORD dwUniqueCount,
115 __in DWORD dwFileAttributes,
116 __out_opt LPWSTR* psczTempFile,
117 __out_opt HANDLE* phTempFile
118 );
119
120/*******************************************************************
121 PathCreateTimeBasedTempFile - creates an empty temp file based on current
122 system time
123********************************************************************/
124DAPI_(HRESULT) PathCreateTimeBasedTempFile(
125 __in_z_opt LPCWSTR wzDirectory,
126 __in_z LPCWSTR wzPrefix,
127 __in_z_opt LPCWSTR wzPostfix,
128 __in_z LPCWSTR wzExtension,
129 __deref_opt_out_z LPWSTR* psczTempFile,
130 __out_opt HANDLE* phTempFile
131 );
132
133/*******************************************************************
134 PathCreateTempDirectory
135
136 Note: if wzDirectory is null, ::GetTempPath() will be used instead.
137*******************************************************************/
138DAPI_(HRESULT) PathCreateTempDirectory(
139 __in_opt LPCWSTR wzDirectory,
140 __in __format_string LPCWSTR wzDirectoryNameTemplate,
141 __in DWORD dwUniqueCount,
142 __out LPWSTR* psczTempDirectory
143 );
144
145/*******************************************************************
146 PathGetKnownFolder - returns the path to a well-known shell folder
147
148*******************************************************************/
149DAPI_(HRESULT) PathGetKnownFolder(
150 __in int csidl,
151 __out LPWSTR* psczKnownFolder
152 );
153
154/*******************************************************************
155 PathIsAbsolute - returns true if the path is absolute; false
156 otherwise.
157*******************************************************************/
158DAPI_(BOOL) PathIsAbsolute(
159 __in_z LPCWSTR wzPath
160 );
161
162/*******************************************************************
163 PathConcat - like .NET's Path.Combine, lets you build up a path
164 one piece -- file or directory -- at a time.
165*******************************************************************/
166DAPI_(HRESULT) PathConcat(
167 __in_opt LPCWSTR wzPath1,
168 __in_opt LPCWSTR wzPath2,
169 __deref_out_z LPWSTR* psczCombined
170 );
171
172/*******************************************************************
173 PathEnsureQuoted - ensures that a path is quoted; optionally,
174 this function also terminates a directory with a backslash
175 if it is not already.
176*******************************************************************/
177DAPI_(HRESULT) PathEnsureQuoted(
178 __inout LPWSTR* ppszPath,
179 __in BOOL fDirectory
180 );
181
182/*******************************************************************
183 PathCompare - compares the fully expanded path of the two paths using
184 ::CompareStringW().
185*******************************************************************/
186DAPI_(HRESULT) PathCompare(
187 __in_z LPCWSTR wzPath1,
188 __in_z LPCWSTR wzPath2,
189 __out int* pnResult
190 );
191
192/*******************************************************************
193 PathCompress - sets the compression state on an existing file or
194 directory. A no-op on file systems that don't
195 support compression.
196*******************************************************************/
197DAPI_(HRESULT) PathCompress(
198 __in_z LPCWSTR wzPath
199 );
200
201/*******************************************************************
202 PathGetHierarchyArray - allocates an array containing,
203 in order, every parent directory of the specified path,
204 ending with the actual input path
205 This function also works with registry subkeys
206*******************************************************************/
207DAPI_(HRESULT) PathGetHierarchyArray(
208 __in_z LPCWSTR wzPath,
209 __deref_inout_ecount_opt(*pcStrArray) LPWSTR **prgsczPathArray,
210 __inout LPUINT pcPathArray
211 );
212
213/*******************************************************************
214 PathCanonicalizePath - wrapper around PathCanonicalizeW.
215*******************************************************************/
216DAPI_(HRESULT) PathCanonicalizePath(
217 __in_z LPCWSTR wzPath,
218 __deref_out_z LPWSTR* psczCanonicalized
219 );
220
221/*******************************************************************
222PathDirectoryContainsPath - checks if wzPath is located inside
223 wzDirectory.
224*******************************************************************/
225DAPI_(HRESULT) PathDirectoryContainsPath(
226 __in_z LPCWSTR wzDirectory,
227 __in_z LPCWSTR wzPath
228 );
229
230#ifdef __cplusplus
231}
232#endif
diff --git a/src/dutil/inc/perfutil.h b/src/dutil/inc/perfutil.h
new file mode 100644
index 00000000..7557511d
--- /dev/null
+++ b/src/dutil/inc/perfutil.h
@@ -0,0 +1,24 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9// structs
10
11
12// functions
13void DAPI PerfInitialize(
14 );
15void DAPI PerfClickTime(
16 __out_opt LARGE_INTEGER* pliElapsed
17 );
18double DAPI PerfConvertToSeconds(
19 __in const LARGE_INTEGER* pli
20 );
21
22#ifdef __cplusplus
23}
24#endif
diff --git a/src/dutil/inc/polcutil.h b/src/dutil/inc/polcutil.h
new file mode 100644
index 00000000..13618043
--- /dev/null
+++ b/src/dutil/inc/polcutil.h
@@ -0,0 +1,39 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9const LPCWSTR POLICY_BURN_REGISTRY_PATH = L"WiX\\Burn";
10
11/********************************************************************
12PolcReadNumber - reads a number from policy.
13
14NOTE: S_FALSE returned if policy not set.
15NOTE: out is set to default on S_FALSE or any error.
16********************************************************************/
17HRESULT DAPI PolcReadNumber(
18 __in_z LPCWSTR wzPolicyPath,
19 __in_z LPCWSTR wzPolicyName,
20 __in DWORD dwDefault,
21 __out DWORD* pdw
22 );
23
24/********************************************************************
25PolcReadString - reads a string from policy.
26
27NOTE: S_FALSE returned if policy not set.
28NOTE: out is set to default on S_FALSE or any error.
29********************************************************************/
30HRESULT DAPI PolcReadString(
31 __in_z LPCWSTR wzPolicyPath,
32 __in_z LPCWSTR wzPolicyName,
33 __in_z_opt LPCWSTR wzDefault,
34 __deref_out_z LPWSTR* pscz
35 );
36
37#ifdef __cplusplus
38}
39#endif
diff --git a/src/dutil/inc/procutil.h b/src/dutil/inc/procutil.h
new file mode 100644
index 00000000..00f3f358
--- /dev/null
+++ b/src/dutil/inc/procutil.h
@@ -0,0 +1,75 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9// structs
10typedef struct _PROC_FILESYSTEMREDIRECTION
11{
12 BOOL fDisabled;
13 LPVOID pvRevertState;
14} PROC_FILESYSTEMREDIRECTION;
15
16HRESULT DAPI ProcElevated(
17 __in HANDLE hProcess,
18 __out BOOL* pfElevated
19 );
20
21HRESULT DAPI ProcWow64(
22 __in HANDLE hProcess,
23 __out BOOL* pfWow64
24 );
25HRESULT DAPI ProcDisableWowFileSystemRedirection(
26 __in PROC_FILESYSTEMREDIRECTION* pfsr
27 );
28HRESULT DAPI ProcRevertWowFileSystemRedirection(
29 __in PROC_FILESYSTEMREDIRECTION* pfsr
30 );
31
32HRESULT DAPI ProcExec(
33 __in_z LPCWSTR wzExecutablePath,
34 __in_z_opt LPCWSTR wzCommandLine,
35 __in int nCmdShow,
36 __out HANDLE *phProcess
37 );
38HRESULT DAPI ProcExecute(
39 __in_z LPWSTR wzCommand,
40 __out HANDLE *phProcess,
41 __out_opt HANDLE *phChildStdIn,
42 __out_opt HANDLE *phChildStdOutErr
43 );
44HRESULT DAPI ProcWaitForCompletion(
45 __in HANDLE hProcess,
46 __in DWORD dwTimeout,
47 __out DWORD *pReturnCode
48 );
49HRESULT DAPI ProcWaitForIds(
50 __in_ecount(cProcessIds) const DWORD* pdwProcessIds,
51 __in DWORD cProcessIds,
52 __in DWORD dwMilliseconds
53 );
54HRESULT DAPI ProcCloseIds(
55 __in_ecount(cProcessIds) const DWORD* pdwProcessIds,
56 __in DWORD cProcessIds
57 );
58
59// following code in proc2utl.cpp due to dependency on PSAPI.DLL.
60HRESULT DAPI ProcFindAllIdsFromExeName(
61 __in_z LPCWSTR wzExeName,
62 __out DWORD** ppdwProcessIds,
63 __out DWORD* pcProcessIds
64 );
65
66// following code in proc3utl.cpp due to dependency on Wtsapi32.DLL.
67HRESULT DAPI ProcExecuteAsInteractiveUser(
68 __in_z LPCWSTR wzExecutablePath,
69 __in_z LPCWSTR wzCommand,
70 __out HANDLE *phProcess
71 );
72
73#ifdef __cplusplus
74}
75#endif
diff --git a/src/dutil/inc/regutil.h b/src/dutil/inc/regutil.h
new file mode 100644
index 00000000..897b9d03
--- /dev/null
+++ b/src/dutil/inc/regutil.h
@@ -0,0 +1,233 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9
10#define ReleaseRegKey(h) if (h) { ::RegCloseKey(h); h = NULL; }
11
12typedef enum REG_KEY_BITNESS
13{
14 REG_KEY_DEFAULT = 0,
15 REG_KEY_32BIT = 1,
16 REG_KEY_64BIT = 2
17} REG_KEY_BITNESS;
18
19typedef LSTATUS (APIENTRY *PFN_REGCREATEKEYEXW)(
20 __in HKEY hKey,
21 __in LPCWSTR lpSubKey,
22 __reserved DWORD Reserved,
23 __in_opt LPWSTR lpClass,
24 __in DWORD dwOptions,
25 __in REGSAM samDesired,
26 __in_opt CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
27 __out PHKEY phkResult,
28 __out_opt LPDWORD lpdwDisposition
29 );
30typedef LSTATUS (APIENTRY *PFN_REGOPENKEYEXW)(
31 __in HKEY hKey,
32 __in_opt LPCWSTR lpSubKey,
33 __reserved DWORD ulOptions,
34 __in REGSAM samDesired,
35 __out PHKEY phkResult
36 );
37typedef LSTATUS (APIENTRY *PFN_REGDELETEKEYEXW)(
38 __in HKEY hKey,
39 __in LPCWSTR lpSubKey,
40 __in REGSAM samDesired,
41 __reserved DWORD Reserved
42 );
43typedef LSTATUS (APIENTRY *PFN_REGDELETEKEYW)(
44 __in HKEY hKey,
45 __in LPCWSTR lpSubKey
46 );
47typedef LSTATUS (APIENTRY *PFN_REGENUMKEYEXW)(
48 __in HKEY hKey,
49 __in DWORD dwIndex,
50 __out LPWSTR lpName,
51 __inout LPDWORD lpcName,
52 __reserved LPDWORD lpReserved,
53 __inout LPWSTR lpClass,
54 __inout_opt LPDWORD lpcClass,
55 __out_opt PFILETIME lpftLastWriteTime
56 );
57typedef LSTATUS (APIENTRY *PFN_REGENUMVALUEW)(
58 __in HKEY hKey,
59 __in DWORD dwIndex,
60 __out LPWSTR lpValueName,
61 __inout LPDWORD lpcchValueName,
62 __reserved LPDWORD lpReserved,
63 __out_opt LPDWORD lpType,
64 __out_opt LPBYTE lpData,
65 __out_opt LPDWORD lpcbData
66 );
67typedef LSTATUS (APIENTRY *PFN_REGQUERYINFOKEYW)(
68 __in HKEY hKey,
69 __out LPWSTR lpClass,
70 __inout_opt LPDWORD lpcClass,
71 __reserved LPDWORD lpReserved,
72 __out_opt LPDWORD lpcSubKeys,
73 __out_opt LPDWORD lpcMaxSubKeyLen,
74 __out_opt LPDWORD lpcMaxClassLen,
75 __out_opt LPDWORD lpcValues,
76 __out_opt LPDWORD lpcMaxValueNameLen,
77 __out_opt LPDWORD lpcMaxValueLen,
78 __out_opt LPDWORD lpcbSecurityDescriptor,
79 __out_opt PFILETIME lpftLastWriteTime
80 );
81typedef LSTATUS (APIENTRY *PFN_REGQUERYVALUEEXW)(
82 __in HKEY hKey,
83 __in_opt LPCWSTR lpValueName,
84 __reserved LPDWORD lpReserved,
85 __out_opt LPDWORD lpType,
86 __out_bcount_part_opt(*lpcbData, *lpcbData) __out_data_source(REGISTRY) LPBYTE lpData,
87 __inout_opt LPDWORD lpcbData
88 );
89typedef LSTATUS (APIENTRY *PFN_REGSETVALUEEXW)(
90 __in HKEY hKey,
91 __in_opt LPCWSTR lpValueName,
92 __reserved DWORD Reserved,
93 __in DWORD dwType,
94 __in_bcount_opt(cbData) CONST BYTE* lpData,
95 __in DWORD cbData
96 );
97typedef LSTATUS (APIENTRY *PFN_REGDELETEVALUEW)(
98 __in HKEY hKey,
99 __in_opt LPCWSTR lpValueName
100 );
101
102HRESULT DAPI RegInitialize();
103void DAPI RegUninitialize();
104
105void DAPI RegFunctionOverride(
106 __in_opt PFN_REGCREATEKEYEXW pfnRegCreateKeyExW,
107 __in_opt PFN_REGOPENKEYEXW pfnRegOpenKeyExW,
108 __in_opt PFN_REGDELETEKEYEXW pfnRegDeleteKeyExW,
109 __in_opt PFN_REGENUMKEYEXW pfnRegEnumKeyExW,
110 __in_opt PFN_REGENUMVALUEW pfnRegEnumValueW,
111 __in_opt PFN_REGQUERYINFOKEYW pfnRegQueryInfoKeyW,
112 __in_opt PFN_REGQUERYVALUEEXW pfnRegQueryValueExW,
113 __in_opt PFN_REGSETVALUEEXW pfnRegSetValueExW,
114 __in_opt PFN_REGDELETEVALUEW pfnRegDeleteValueW
115 );
116HRESULT DAPI RegCreate(
117 __in HKEY hkRoot,
118 __in_z LPCWSTR wzSubKey,
119 __in DWORD dwAccess,
120 __out HKEY* phk
121 );
122HRESULT DAPI RegCreateEx(
123 __in HKEY hkRoot,
124 __in_z LPCWSTR wzSubKey,
125 __in DWORD dwAccess,
126 __in BOOL fVolatile,
127 __in_opt SECURITY_ATTRIBUTES* pSecurityAttributes,
128 __out HKEY* phk,
129 __out_opt BOOL* pfCreated
130 );
131HRESULT DAPI RegOpen(
132 __in HKEY hkRoot,
133 __in_z LPCWSTR wzSubKey,
134 __in DWORD dwAccess,
135 __out HKEY* phk
136 );
137HRESULT DAPI RegDelete(
138 __in HKEY hkRoot,
139 __in_z LPCWSTR wzSubKey,
140 __in REG_KEY_BITNESS kbKeyBitness,
141 __in BOOL fDeleteTree
142 );
143HRESULT DAPI RegKeyEnum(
144 __in HKEY hk,
145 __in DWORD dwIndex,
146 __deref_out_z LPWSTR* psczKey
147 );
148HRESULT DAPI RegValueEnum(
149 __in HKEY hk,
150 __in DWORD dwIndex,
151 __deref_out_z LPWSTR* psczName,
152 __out_opt DWORD *pdwType
153 );
154HRESULT DAPI RegGetType(
155 __in HKEY hk,
156 __in_z_opt LPCWSTR wzName,
157 __out DWORD *pdwType
158 );
159HRESULT DAPI RegReadBinary(
160 __in HKEY hk,
161 __in_z_opt LPCWSTR wzName,
162 __deref_out_bcount_opt(*pcbBuffer) BYTE** ppbBuffer,
163 __out SIZE_T *pcbBuffer
164 );
165HRESULT DAPI RegReadString(
166 __in HKEY hk,
167 __in_z_opt LPCWSTR wzName,
168 __deref_out_z LPWSTR* psczValue
169 );
170HRESULT DAPI RegReadStringArray(
171 __in HKEY hk,
172 __in_z_opt LPCWSTR wzName,
173 __deref_out_ecount_opt(pcStrings) LPWSTR** prgsczStrings,
174 __out DWORD *pcStrings
175 );
176HRESULT DAPI RegReadVersion(
177 __in HKEY hk,
178 __in_z_opt LPCWSTR wzName,
179 __out DWORD64* pdw64Version
180 );
181HRESULT DAPI RegReadNumber(
182 __in HKEY hk,
183 __in_z_opt LPCWSTR wzName,
184 __out DWORD* pdwValue
185 );
186HRESULT DAPI RegReadQword(
187 __in HKEY hk,
188 __in_z_opt LPCWSTR wzName,
189 __out DWORD64* pqwValue
190 );
191HRESULT DAPI RegWriteBinary(
192 __in HKEY hk,
193 __in_z_opt LPCWSTR wzName,
194 __in_bcount(cbBuffer) const BYTE *pbBuffer,
195 __in DWORD cbBuffer
196 );
197HRESULT DAPI RegWriteString(
198 __in HKEY hk,
199 __in_z_opt LPCWSTR wzName,
200 __in_z_opt LPCWSTR wzValue
201 );
202HRESULT DAPI RegWriteStringArray(
203 __in HKEY hk,
204 __in_z_opt LPCWSTR wzName,
205 __in_ecount(cValues) LPWSTR *rgwzStrings,
206 __in DWORD cStrings
207 );
208HRESULT DAPI RegWriteStringFormatted(
209 __in HKEY hk,
210 __in_z_opt LPCWSTR wzName,
211 __in __format_string LPCWSTR szFormat,
212 ...
213 );
214HRESULT DAPI RegWriteNumber(
215 __in HKEY hk,
216 __in_z_opt LPCWSTR wzName,
217 __in DWORD dwValue
218 );
219HRESULT DAPI RegWriteQword(
220 __in HKEY hk,
221 __in_z_opt LPCWSTR wzName,
222 __in DWORD64 qwValue
223 );
224HRESULT DAPI RegQueryKey(
225 __in HKEY hk,
226 __out_opt DWORD* pcSubKeys,
227 __out_opt DWORD* pcValues
228 );
229
230#ifdef __cplusplus
231}
232#endif
233
diff --git a/src/dutil/inc/resrutil.h b/src/dutil/inc/resrutil.h
new file mode 100644
index 00000000..1f4d8e17
--- /dev/null
+++ b/src/dutil/inc/resrutil.h
@@ -0,0 +1,43 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9HRESULT DAPI ResGetStringLangId(
10 __in_opt LPCWSTR wzPath,
11 __in UINT uID,
12 __out WORD *pwLangId
13 );
14
15HRESULT DAPI ResReadString(
16 __in HINSTANCE hinst,
17 __in UINT uID,
18 __deref_out_z LPWSTR* ppwzString
19 );
20
21HRESULT DAPI ResReadStringAnsi(
22 __in HINSTANCE hinst,
23 __in UINT uID,
24 __deref_out_z LPSTR* ppszString
25 );
26
27HRESULT DAPI ResReadData(
28 __in_opt HINSTANCE hinst,
29 __in_z LPCSTR szDataName,
30 __deref_out_bcount(*pcb) PVOID *ppv,
31 __out DWORD *pcb
32 );
33
34HRESULT DAPI ResExportDataToFile(
35 __in_z LPCSTR szDataName,
36 __in_z LPCWSTR wzTargetFile,
37 __in DWORD dwCreationDisposition
38 );
39
40#ifdef __cplusplus
41}
42#endif
43
diff --git a/src/dutil/inc/reswutil.h b/src/dutil/inc/reswutil.h
new file mode 100644
index 00000000..31435ae2
--- /dev/null
+++ b/src/dutil/inc/reswutil.h
@@ -0,0 +1,31 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9HRESULT DAPI ResWriteString(
10 __in_z LPCWSTR wzResourceFile,
11 __in DWORD dwDataId,
12 __in_z LPCWSTR wzData,
13 __in WORD wLangId
14 );
15
16HRESULT DAPI ResWriteData(
17 __in_z LPCWSTR wzResourceFile,
18 __in_z LPCSTR szDataName,
19 __in PVOID pData,
20 __in DWORD cbData
21 );
22
23HRESULT DAPI ResImportDataFromFile(
24 __in_z LPCWSTR wzTargetFile,
25 __in_z LPCWSTR wzSourceFile,
26 __in_z LPCSTR szDataName
27 );
28
29#ifdef __cplusplus
30}
31#endif
diff --git a/src/dutil/inc/rexutil.h b/src/dutil/inc/rexutil.h
new file mode 100644
index 00000000..77f5604a
--- /dev/null
+++ b/src/dutil/inc/rexutil.h
@@ -0,0 +1,54 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <sys\stat.h>
6#include <fdi.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12// defines
13#define FILETABLESIZE 40
14
15// structs
16struct MEM_FILE
17{
18 LPCBYTE vpStart;
19 UINT uiCurrent;
20 UINT uiLength;
21};
22
23typedef enum FAKE_FILE_TYPE { NORMAL_FILE, MEMORY_FILE } FAKE_FILE_TYPE;
24
25typedef HRESULT (*REX_CALLBACK_PROGRESS)(BOOL fBeginFile, LPCWSTR wzFileId, LPVOID pvContext);
26typedef VOID (*REX_CALLBACK_WRITE)(UINT cb);
27
28
29struct FAKE_FILE // used __in internal file table
30{
31 BOOL fUsed;
32 FAKE_FILE_TYPE fftType;
33 MEM_FILE mfFile; // State for memory file
34 HANDLE hFile; // Handle for disk file
35};
36
37// functions
38HRESULT RexInitialize();
39void RexUninitialize();
40
41HRESULT RexExtract(
42 __in_z LPCSTR szResource,
43 __in_z LPCWSTR wzExtractId,
44 __in_z LPCWSTR wzExtractDir,
45 __in_z LPCWSTR wzExtractName,
46 __in REX_CALLBACK_PROGRESS pfnProgress,
47 __in REX_CALLBACK_WRITE pfnWrite,
48 __in LPVOID pvContext
49 );
50
51#ifdef __cplusplus
52}
53#endif
54
diff --git a/src/dutil/inc/rmutil.h b/src/dutil/inc/rmutil.h
new file mode 100644
index 00000000..ce7bf254
--- /dev/null
+++ b/src/dutil/inc/rmutil.h
@@ -0,0 +1,46 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9typedef struct _RMU_SESSION *PRMU_SESSION;
10
11HRESULT DAPI RmuJoinSession(
12 __out PRMU_SESSION *ppSession,
13 __in_z LPCWSTR wzSessionKey
14 );
15
16HRESULT DAPI RmuAddFile(
17 __in PRMU_SESSION pSession,
18 __in_z LPCWSTR wzPath
19 );
20
21HRESULT DAPI RmuAddProcessById(
22 __in PRMU_SESSION pSession,
23 __in DWORD dwProcessId
24 );
25
26HRESULT DAPI RmuAddProcessesByName(
27 __in PRMU_SESSION pSession,
28 __in_z LPCWSTR wzProcessName
29 );
30
31HRESULT DAPI RmuAddService(
32 __in PRMU_SESSION pSession,
33 __in_z LPCWSTR wzServiceName
34 );
35
36HRESULT DAPI RmuRegisterResources(
37 __in PRMU_SESSION pSession
38 );
39
40HRESULT DAPI RmuEndSession(
41 __in PRMU_SESSION pSession
42 );
43
44#ifdef __cplusplus
45}
46#endif
diff --git a/src/dutil/inc/rssutil.h b/src/dutil/inc/rssutil.h
new file mode 100644
index 00000000..064ab147
--- /dev/null
+++ b/src/dutil/inc/rssutil.h
@@ -0,0 +1,89 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseRssChannel(p) if (p) { RssFreeChannel(p); }
10#define ReleaseNullRssChannel(p) if (p) { RssFreeChannel(p); p = NULL; }
11
12
13struct RSS_UNKNOWN_ATTRIBUTE
14{
15 LPWSTR wzNamespace;
16 LPWSTR wzAttribute;
17 LPWSTR wzValue;
18
19 RSS_UNKNOWN_ATTRIBUTE* pNext;
20};
21
22struct RSS_UNKNOWN_ELEMENT
23{
24 LPWSTR wzNamespace;
25 LPWSTR wzElement;
26 LPWSTR wzValue;
27
28 RSS_UNKNOWN_ATTRIBUTE* pAttributes;
29 RSS_UNKNOWN_ELEMENT* pNext;
30};
31
32struct RSS_ITEM
33{
34 LPWSTR wzTitle;
35 LPWSTR wzLink;
36 LPWSTR wzDescription;
37
38 LPWSTR wzGuid;
39 FILETIME ftPublished;
40
41 LPWSTR wzEnclosureUrl;
42 DWORD dwEnclosureSize;
43 LPWSTR wzEnclosureType;
44
45 RSS_UNKNOWN_ELEMENT* pUnknownElements;
46};
47
48struct RSS_CHANNEL
49{
50 LPWSTR wzTitle;
51 LPWSTR wzLink;
52 LPWSTR wzDescription;
53 DWORD dwTimeToLive;
54
55 RSS_UNKNOWN_ELEMENT* pUnknownElements;
56
57 DWORD cItems;
58 RSS_ITEM rgItems[1];
59};
60
61HRESULT DAPI RssInitialize(
62 );
63
64void DAPI RssUninitialize(
65 );
66
67HRESULT DAPI RssParseFromString(
68 __in_z LPCWSTR wzRssString,
69 __out RSS_CHANNEL **ppChannel
70 );
71
72HRESULT DAPI RssParseFromFile(
73 __in_z LPCWSTR wzRssFile,
74 __out RSS_CHANNEL **ppChannel
75 );
76
77// Adding this until we have the updated specstrings.h
78#ifndef __in_xcount
79#define __in_xcount(size)
80#endif
81
82void DAPI RssFreeChannel(
83 __in_xcount(pChannel->cItems) RSS_CHANNEL *pChannel
84 );
85
86#ifdef __cplusplus
87}
88#endif
89
diff --git a/src/dutil/inc/sceutil.h b/src/dutil/inc/sceutil.h
new file mode 100644
index 00000000..9d14eecf
--- /dev/null
+++ b/src/dutil/inc/sceutil.h
@@ -0,0 +1,273 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#include <sqlce_oledb.h>
10#include <sqlce_sync.h>
11#include <sqlce_err.h>
12
13typedef void* SCE_DATABASE_HANDLE;
14typedef void* SCE_ROW_HANDLE;
15typedef void* SCE_QUERY_HANDLE;
16typedef void* SCE_QUERY_RESULTS_HANDLE;
17
18extern const int SCE_ROW_HANDLE_BYTES;
19extern const int SCE_QUERY_HANDLE_BYTES;
20extern const int SCE_QUERY_RESULTS_HANDLE_BYTES;
21
22#define ReleaseSceRow(prrh) if (prrh) { SceFreeRow(prrh); }
23#define ReleaseNullSceRow(prrh) if (prrh) { SceFreeRow(prrh); prrh = NULL; }
24#define ReleaseSceQuery(pqh) if (pqh) { SceFreeQuery(pqh); }
25#define ReleaseNullSceQuery(pqh) if (pqh) { SceFreeQuery(pqh); pqh = NULL; }
26#define ReleaseSceQueryResults(pqh) if (pqh) { SceFreeQueryResults(pqh); }
27#define ReleaseNullSceQueryResults(pqh) if (pqh) { SceFreeQueryResults(pqh); pqh = NULL; }
28
29struct SCE_COLUMN_SCHEMA
30{
31 LPCWSTR wzName;
32 DBTYPE dbtColumnType;
33 DWORD dwLength;
34 BOOL fPrimaryKey; // If this column is the primary key
35 BOOL fNullable;
36 BOOL fAutoIncrement;
37 BOOL fDescending; // If this column should be descending when used in an index (default is ascending)
38
39 LPWSTR wzRelationName;
40 DWORD dwForeignKeyTable;
41 DWORD dwForeignKeyColumn;
42};
43
44struct SCE_INDEX_SCHEMA
45{
46 LPWSTR wzName;
47
48 DWORD *rgColumns;
49 DWORD cColumns;
50};
51
52struct SCE_TABLE_SCHEMA
53{
54 LPCWSTR wzName;
55 DWORD cColumns;
56 SCE_COLUMN_SCHEMA *rgColumns;
57
58 DWORD cIndexes;
59 SCE_INDEX_SCHEMA *rgIndexes;
60
61 // Internal to SCEUtil - consumers shouldn't access or modify
62 // TODO: enforce / hide in a handle of some sort?
63 IRowset *pIRowset;
64 IRowsetChange *pIRowsetChange;
65};
66
67struct SCE_DATABASE_SCHEMA
68{
69 DWORD cTables;
70 SCE_TABLE_SCHEMA *rgTables;
71};
72
73struct SCE_DATABASE
74{
75 SCE_DATABASE_HANDLE sdbHandle;
76 SCE_DATABASE_SCHEMA *pdsSchema;
77};
78
79HRESULT DAPI SceCreateDatabase(
80 __in_z LPCWSTR sczFile,
81 __in_z_opt LPCWSTR wzSqlCeDllPath,
82 __deref_out SCE_DATABASE **ppDatabase
83 );
84HRESULT DAPI SceOpenDatabase(
85 __in_z LPCWSTR sczFile,
86 __in_z_opt LPCWSTR wzSqlCeDllPath,
87 __in LPCWSTR wzSchemaType,
88 __in DWORD dwExpectedVersion,
89 __deref_out SCE_DATABASE **ppDatabase,
90 __in BOOL fReadOnly
91 );
92HRESULT DAPI SceEnsureDatabase(
93 __in_z LPCWSTR sczFile,
94 __in_z_opt LPCWSTR wzSqlCeDllPath,
95 __in LPCWSTR wzSchemaType,
96 __in DWORD dwExpectedVersion,
97 __in SCE_DATABASE_SCHEMA *pdsSchema,
98 __deref_out SCE_DATABASE **ppDatabase
99 );
100HRESULT DAPI SceIsTableEmpty(
101 __in SCE_DATABASE *pDatabase,
102 __in DWORD dwTableIndex,
103 __out BOOL *pfEmpty
104 );
105HRESULT DAPI SceGetFirstRow(
106 __in SCE_DATABASE *pDatabase,
107 __in DWORD dwTableIndex,
108 __deref_out_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE *pRowHandle
109 );
110HRESULT DAPI SceGetNextRow(
111 __in SCE_DATABASE *pDatabase,
112 __in DWORD dwTableIndex,
113 __deref_out_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE *pRowHandle
114 );
115HRESULT DAPI SceBeginTransaction(
116 __in SCE_DATABASE *pDatabase
117 );
118HRESULT DAPI SceCommitTransaction(
119 __in SCE_DATABASE *pDatabase
120 );
121HRESULT DAPI SceRollbackTransaction(
122 __in SCE_DATABASE *pDatabase
123 );
124HRESULT DAPI SceDeleteRow(
125 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE *pRowHandle
126 );
127HRESULT DAPI ScePrepareInsert(
128 __in SCE_DATABASE *pDatabase,
129 __in DWORD dwTableIndex,
130 __deref_out_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE *pRowHandle
131 );
132HRESULT DAPI SceFinishUpdate(
133 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle
134 );
135HRESULT DAPI SceSetColumnBinary(
136 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle,
137 __in DWORD dwColumnIndex,
138 __in_bcount(cbBuffer) const BYTE* pbBuffer,
139 __in SIZE_T cbBuffer
140 );
141HRESULT DAPI SceSetColumnDword(
142 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle,
143 __in DWORD dwColumnIndex,
144 __in const DWORD dwValue
145 );
146HRESULT DAPI SceSetColumnQword(
147 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle,
148 __in DWORD dwColumnIndex,
149 __in const DWORD64 qwValue
150 );
151HRESULT DAPI SceSetColumnBool(
152 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle,
153 __in DWORD dwColumnIndex,
154 __in const BOOL fValue
155 );
156HRESULT DAPI SceSetColumnString(
157 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle,
158 __in DWORD dwColumnIndex,
159 __in_z_opt LPCWSTR wzValue
160 );
161HRESULT DAPI SceSetColumnSystemTime(
162 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle,
163 __in DWORD dwColumnIndex,
164 __in const SYSTEMTIME *pst
165 );
166HRESULT DAPI SceSetColumnNull(
167 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle,
168 __in DWORD dwColumnIndex
169 );
170HRESULT DAPI SceGetColumnBinary(
171 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowReadHandle,
172 __in DWORD dwColumnIndex,
173 __out_opt BYTE **ppbBuffer,
174 __inout SIZE_T *pcbBuffer
175 );
176HRESULT DAPI SceGetColumnDword(
177 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowReadHandle,
178 __in DWORD dwColumnIndex,
179 __out DWORD *pdwValue
180 );
181HRESULT DAPI SceGetColumnQword(
182 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowReadHandle,
183 __in DWORD dwColumnIndex,
184 __out DWORD64 *pqwValue
185 );
186HRESULT DAPI SceGetColumnBool(
187 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowReadHandle,
188 __in DWORD dwColumnIndex,
189 __out BOOL *pfValue
190 );
191HRESULT DAPI SceGetColumnString(
192 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowReadHandle,
193 __in DWORD dwColumnIndex,
194 __out_z LPWSTR *psczValue
195 );
196HRESULT DAPI SceGetColumnSystemTime(
197 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowReadHandle,
198 __in DWORD dwColumnIndex,
199 __out SYSTEMTIME *pst
200 );
201HRESULT DAPI SceBeginQuery(
202 __in SCE_DATABASE *pDatabase,
203 __in DWORD dwTableIndex,
204 __in DWORD dwIndex,
205 __deref_out_bcount(SCE_QUERY_HANDLE_BYTES) SCE_QUERY_HANDLE *psqhHandle
206 );
207HRESULT DAPI SceSetQueryColumnBinary(
208 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE sqhHandle,
209 __in_bcount(cbBuffer) const BYTE* pbBuffer,
210 __in SIZE_T cbBuffer
211 );
212HRESULT DAPI SceSetQueryColumnDword(
213 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE sqhHandle,
214 __in const DWORD dwValue
215 );
216HRESULT DAPI SceSetQueryColumnQword(
217 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE sqhHandle,
218 __in const DWORD64 qwValue
219 );
220HRESULT DAPI SceSetQueryColumnBool(
221 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE sqhHandle,
222 __in const BOOL fValue
223 );
224HRESULT DAPI SceSetQueryColumnString(
225 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE sqhHandle,
226 __in_z_opt LPCWSTR wzString
227 );
228HRESULT DAPI SceSetQueryColumnSystemTime(
229 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowHandle,
230 __in const SYSTEMTIME *pst
231 );
232HRESULT DAPI SceSetQueryColumnEmpty(
233 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE sqhHandle
234 );
235HRESULT DAPI SceRunQueryExact(
236 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE *psqhHandle,
237 __deref_out_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE *pRowHandle
238 );
239HRESULT DAPI SceRunQueryRange(
240 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE *psqhHandle,
241 __deref_out_bcount(SCE_QUERY_RESULTS_BYTES) SCE_QUERY_RESULTS_HANDLE *psqrhHandle
242 );
243HRESULT DAPI SceGetNextResultRow(
244 __in_bcount(SCE_QUERY_RESULTS_BYTES) SCE_QUERY_RESULTS_HANDLE sqrhHandle,
245 __deref_out_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE *pRowHandle
246 );
247void DAPI SceCloseTable(
248 __in SCE_TABLE_SCHEMA *pTable
249 );
250// Returns whether the data in the database changed. Ignores schema changes.
251BOOL DAPI SceDatabaseChanged(
252 __in SCE_DATABASE *pDatabase
253 );
254// Resets the database changed flag
255void DAPI SceResetDatabaseChanged(
256 __in SCE_DATABASE *pDatabase
257 );
258HRESULT DAPI SceCloseDatabase(
259 __in SCE_DATABASE *pDatabase
260 );
261void DAPI SceFreeRow(
262 __in_bcount(SCE_ROW_HANDLE_BYTES) SCE_ROW_HANDLE rowReadHandle
263 );
264void DAPI SceFreeQuery(
265 __in_bcount(SCE_QUERY_BYTES) SCE_QUERY_HANDLE sqhHandle
266 );
267void DAPI SceFreeQueryResults(
268 __in_bcount(SCE_QUERY_RESULTS_BYTES) SCE_QUERY_RESULTS_HANDLE sqrhHandle
269 );
270
271#ifdef __cplusplus
272}
273#endif
diff --git a/src/dutil/inc/sczutil.h b/src/dutil/inc/sczutil.h
new file mode 100644
index 00000000..fcfbd13a
--- /dev/null
+++ b/src/dutil/inc/sczutil.h
@@ -0,0 +1,30 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6class PSCZ
7{
8public:
9 PSCZ() : m_scz(NULL) { }
10
11 ~PSCZ() { ReleaseNullStr(m_scz); }
12
13 operator LPWSTR() { return m_scz; }
14
15 operator LPCWSTR() { return m_scz; }
16
17 operator bool() { return NULL != m_scz; }
18
19 LPWSTR* operator &() { return &m_scz; }
20
21 bool operator !() { return !m_scz; }
22
23 WCHAR operator *() { return *m_scz; }
24
25 LPWSTR Detach() { LPWSTR scz = m_scz; m_scz = NULL; return scz; }
26
27private:
28 LPWSTR m_scz;
29};
30#endif //__cplusplus
diff --git a/src/dutil/inc/shelutil.h b/src/dutil/inc/shelutil.h
new file mode 100644
index 00000000..21e82672
--- /dev/null
+++ b/src/dutil/inc/shelutil.h
@@ -0,0 +1,47 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifndef REFKNOWNFOLDERID
6#define REFKNOWNFOLDERID REFGUID
7#endif
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13typedef BOOL (STDAPICALLTYPE *PFN_SHELLEXECUTEEXW)(
14 __inout LPSHELLEXECUTEINFOW lpExecInfo
15 );
16
17void DAPI ShelFunctionOverride(
18 __in_opt PFN_SHELLEXECUTEEXW pfnShellExecuteExW
19 );
20HRESULT DAPI ShelExec(
21 __in_z LPCWSTR wzTargetPath,
22 __in_opt LPCWSTR wzParameters,
23 __in_opt LPCWSTR wzVerb,
24 __in_opt LPCWSTR wzWorkingDirectory,
25 __in int nShowCmd,
26 __in_opt HWND hwndParent,
27 __out_opt HANDLE* phProcess
28 );
29HRESULT DAPI ShelExecUnelevated(
30 __in_z LPCWSTR wzTargetPath,
31 __in_z_opt LPCWSTR wzParameters,
32 __in_z_opt LPCWSTR wzVerb,
33 __in_z_opt LPCWSTR wzWorkingDirectory,
34 __in int nShowCmd
35 );
36HRESULT DAPI ShelGetFolder(
37 __out_z LPWSTR* psczFolderPath,
38 __in int csidlFolder
39 );
40HRESULT DAPI ShelGetKnownFolder(
41 __out_z LPWSTR* psczFolderPath,
42 __in REFKNOWNFOLDERID rfidFolder
43 );
44
45#ifdef __cplusplus
46}
47#endif
diff --git a/src/dutil/inc/sqlutil.h b/src/dutil/inc/sqlutil.h
new file mode 100644
index 00000000..ddf09323
--- /dev/null
+++ b/src/dutil/inc/sqlutil.h
@@ -0,0 +1,136 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <cguid.h>
6#include <oledberr.h>
7#include <sqloledb.h>
8
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14// Adding this until the SQL annotations are published to specstrings.h
15#ifndef __sql_command
16#define __sql_command
17#endif
18
19// structs
20struct SQL_FILESPEC
21{
22 WCHAR wzName[MAX_PATH];
23 WCHAR wzFilename[MAX_PATH];
24 WCHAR wzSize[MAX_PATH];
25 WCHAR wzMaxSize[MAX_PATH];
26 WCHAR wzGrow[MAX_PATH];
27};
28
29
30// functions
31HRESULT DAPI SqlConnectDatabase(
32 __in_z LPCWSTR wzServer,
33 __in_z LPCWSTR wzInstance,
34 __in_z LPCWSTR wzDatabase,
35 __in BOOL fIntegratedAuth,
36 __in_z LPCWSTR wzUser,
37 __in_z LPCWSTR wzPassword,
38 __out IDBCreateSession** ppidbSession
39 );
40HRESULT DAPI SqlStartTransaction(
41 __in IDBCreateSession* pidbSession,
42 __out IDBCreateCommand** ppidbCommand,
43 __out ITransaction** ppit
44 );
45HRESULT DAPI SqlEndTransaction(
46 __in ITransaction* pit,
47 __in BOOL fCommit
48 );
49HRESULT DAPI SqlDatabaseExists(
50 __in_z LPCWSTR wzServer,
51 __in_z LPCWSTR wzInstance,
52 __in_z LPCWSTR wzDatabase,
53 __in BOOL fIntegratedAuth,
54 __in_z LPCWSTR wzUser,
55 __in_z LPCWSTR wzPassword,
56 __out_opt BSTR* pbstrErrorDescription
57 );
58HRESULT DAPI SqlSessionDatabaseExists(
59 __in IDBCreateSession* pidbSession,
60 __in_z LPCWSTR wzDatabase,
61 __out_opt BSTR* pbstrErrorDescription
62 );
63HRESULT DAPI SqlDatabaseEnsureExists(
64 __in_z LPCWSTR wzServer,
65 __in_z LPCWSTR wzInstance,
66 __in_z LPCWSTR wzDatabase,
67 __in BOOL fIntegratedAuth,
68 __in_z LPCWSTR wzUser,
69 __in_z LPCWSTR wzPassword,
70 __in_opt const SQL_FILESPEC* psfDatabase,
71 __in_opt const SQL_FILESPEC* psfLog,
72 __out_opt BSTR* pbstrErrorDescription
73 );
74HRESULT DAPI SqlSessionDatabaseEnsureExists(
75 __in IDBCreateSession* pidbSession,
76 __in_z LPCWSTR wzDatabase,
77 __in_opt const SQL_FILESPEC* psfDatabase,
78 __in_opt const SQL_FILESPEC* psfLog,
79 __out_opt BSTR* pbstrErrorDescription
80 );
81HRESULT DAPI SqlCreateDatabase(
82 __in_z LPCWSTR wzServer,
83 __in_z LPCWSTR wzInstance,
84 __in_z LPCWSTR wzDatabase,
85 __in BOOL fIntegratedAuth,
86 __in_z LPCWSTR wzUser,
87 __in_z LPCWSTR wzPassword,
88 __in_opt const SQL_FILESPEC* psfDatabase,
89 __in_opt const SQL_FILESPEC* psfLog,
90 __out_opt BSTR* pbstrErrorDescription
91 );
92HRESULT DAPI SqlSessionCreateDatabase(
93 __in IDBCreateSession* pidbSession,
94 __in_z LPCWSTR wzDatabase,
95 __in_opt const SQL_FILESPEC* psfDatabase,
96 __in_opt const SQL_FILESPEC* psfLog,
97 __out_opt BSTR* pbstrErrorDescription
98 );
99HRESULT DAPI SqlDropDatabase(
100 __in_z LPCWSTR wzServer,
101 __in_z LPCWSTR wzInstance,
102 __in_z LPCWSTR wzDatabase,
103 __in BOOL fIntegratedAuth,
104 __in_z LPCWSTR wzUser,
105 __in_z LPCWSTR wzPassword,
106 __out_opt BSTR* pbstrErrorDescription
107 );
108HRESULT DAPI SqlSessionDropDatabase(
109 __in IDBCreateSession* pidbSession,
110 __in_z LPCWSTR wzDatabase,
111 __out_opt BSTR* pbstrErrorDescription
112 );
113HRESULT DAPI SqlSessionExecuteQuery(
114 __in IDBCreateSession* pidbSession,
115 __in __sql_command LPCWSTR wzSql,
116 __out_opt IRowset** ppirs,
117 __out_opt DBROWCOUNT* pcRows,
118 __out_opt BSTR* pbstrErrorDescription
119 );
120HRESULT DAPI SqlCommandExecuteQuery(
121 __in IDBCreateCommand* pidbCommand,
122 __in __sql_command LPCWSTR wzSql,
123 __out IRowset** ppirs,
124 __out DBROWCOUNT* pcRows
125 );
126HRESULT DAPI SqlGetErrorInfo(
127 __in IUnknown* pObjectWithError,
128 __in REFIID IID_InterfaceWithError,
129 __in DWORD dwLocaleId,
130 __out_opt BSTR* pbstrErrorSource,
131 __out_opt BSTR* pbstrErrorDescription
132 );
133
134#ifdef __cplusplus
135}
136#endif
diff --git a/src/dutil/inc/srputil.h b/src/dutil/inc/srputil.h
new file mode 100644
index 00000000..95e96231
--- /dev/null
+++ b/src/dutil/inc/srputil.h
@@ -0,0 +1,45 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9
10typedef enum SRP_ACTION
11{
12 SRP_ACTION_UNKNOWN,
13 SRP_ACTION_UNINSTALL,
14 SRP_ACTION_INSTALL,
15 SRP_ACTION_MODIFY,
16} SRP_ACTION;
17
18
19/********************************************************************
20 SrpInitialize - initializes system restore point functionality.
21
22*******************************************************************/
23DAPI_(HRESULT) SrpInitialize(
24 __in BOOL fInitializeComSecurity
25 );
26
27/********************************************************************
28 SrpUninitialize - uninitializes system restore point functionality.
29
30*******************************************************************/
31DAPI_(void) SrpUninitialize();
32
33/********************************************************************
34 SrpCreateRestorePoint - creates a system restore point.
35
36*******************************************************************/
37DAPI_(HRESULT) SrpCreateRestorePoint(
38 __in_z LPCWSTR wzApplicationName,
39 __in SRP_ACTION action
40 );
41
42#ifdef __cplusplus
43}
44#endif
45
diff --git a/src/dutil/inc/strutil.h b/src/dutil/inc/strutil.h
new file mode 100644
index 00000000..1a2ed1d8
--- /dev/null
+++ b/src/dutil/inc/strutil.h
@@ -0,0 +1,311 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseStr(pwz) if (pwz) { StrFree(pwz); }
10#define ReleaseNullStr(pwz) if (pwz) { StrFree(pwz); pwz = NULL; }
11#define ReleaseBSTR(bstr) if (bstr) { ::SysFreeString(bstr); }
12#define ReleaseNullBSTR(bstr) if (bstr) { ::SysFreeString(bstr); bstr = NULL; }
13#define ReleaseStrArray(rg, c) { if (rg) { StrArrayFree(rg, c); } }
14#define ReleaseNullStrArray(rg, c) { if (rg) { StrArrayFree(rg, c); c = 0; rg = NULL; } }
15#define ReleaseNullStrSecure(pwz) if (pwz) { StrSecureZeroFreeString(pwz); pwz = NULL; }
16
17#define DeclareConstBSTR(bstr_const, wz) const WCHAR bstr_const[] = { 0x00, 0x00, sizeof(wz)-sizeof(WCHAR), 0x00, wz }
18#define UseConstBSTR(bstr_const) const_cast<BSTR>(bstr_const + 4)
19
20HRESULT DAPI StrAlloc(
21 __deref_out_ecount_part(cch, 0) LPWSTR* ppwz,
22 __in DWORD_PTR cch
23 );
24HRESULT DAPI StrAllocSecure(
25 __deref_out_ecount_part(cch, 0) LPWSTR* ppwz,
26 __in DWORD_PTR cch
27 );
28HRESULT DAPI StrTrimCapacity(
29 __deref_out_z LPWSTR* ppwz
30 );
31HRESULT DAPI StrTrimWhitespace(
32 __deref_out_z LPWSTR* ppwz,
33 __in_z LPCWSTR wzSource
34 );
35HRESULT DAPI StrAnsiAlloc(
36 __deref_out_ecount_part(cch, 0) LPSTR* ppz,
37 __in DWORD_PTR cch
38 );
39HRESULT DAPI StrAnsiTrimCapacity(
40 __deref_out_z LPSTR* ppz
41 );
42HRESULT DAPI StrAnsiTrimWhitespace(
43 __deref_out_z LPSTR* ppz,
44 __in_z LPCSTR szSource
45 );
46HRESULT DAPI StrAllocString(
47 __deref_out_ecount_z(cchSource+1) LPWSTR* ppwz,
48 __in_z LPCWSTR wzSource,
49 __in DWORD_PTR cchSource
50 );
51HRESULT DAPI StrAllocStringSecure(
52 __deref_out_ecount_z(cchSource + 1) LPWSTR* ppwz,
53 __in_z LPCWSTR wzSource,
54 __in DWORD_PTR cchSource
55 );
56HRESULT DAPI StrAnsiAllocString(
57 __deref_out_ecount_z(cchSource+1) LPSTR* ppsz,
58 __in_z LPCWSTR wzSource,
59 __in DWORD_PTR cchSource,
60 __in UINT uiCodepage
61 );
62HRESULT DAPI StrAllocStringAnsi(
63 __deref_out_ecount_z(cchSource+1) LPWSTR* ppwz,
64 __in_z LPCSTR szSource,
65 __in DWORD_PTR cchSource,
66 __in UINT uiCodepage
67 );
68HRESULT DAPI StrAnsiAllocStringAnsi(
69 __deref_out_ecount_z(cchSource+1) LPSTR* ppsz,
70 __in_z LPCSTR szSource,
71 __in DWORD_PTR cchSource
72 );
73HRESULT DAPI StrAllocPrefix(
74 __deref_out_z LPWSTR* ppwz,
75 __in_z LPCWSTR wzPrefix,
76 __in DWORD_PTR cchPrefix
77 );
78HRESULT DAPI StrAllocConcat(
79 __deref_out_z LPWSTR* ppwz,
80 __in_z LPCWSTR wzSource,
81 __in DWORD_PTR cchSource
82 );
83HRESULT DAPI StrAllocConcatSecure(
84 __deref_out_z LPWSTR* ppwz,
85 __in_z LPCWSTR wzSource,
86 __in DWORD_PTR cchSource
87 );
88HRESULT DAPI StrAnsiAllocConcat(
89 __deref_out_z LPSTR* ppz,
90 __in_z LPCSTR pzSource,
91 __in DWORD_PTR cchSource
92 );
93HRESULT __cdecl StrAllocFormatted(
94 __deref_out_z LPWSTR* ppwz,
95 __in __format_string LPCWSTR wzFormat,
96 ...
97 );
98HRESULT __cdecl StrAllocConcatFormatted(
99 __deref_out_z LPWSTR* ppwz,
100 __in __format_string LPCWSTR wzFormat,
101 ...
102 );
103HRESULT __cdecl StrAllocFormattedSecure(
104 __deref_out_z LPWSTR* ppwz,
105 __in __format_string LPCWSTR wzFormat,
106 ...
107 );
108HRESULT __cdecl StrAnsiAllocFormatted(
109 __deref_out_z LPSTR* ppsz,
110 __in __format_string LPCSTR szFormat,
111 ...
112 );
113HRESULT DAPI StrAllocFormattedArgs(
114 __deref_out_z LPWSTR* ppwz,
115 __in __format_string LPCWSTR wzFormat,
116 __in va_list args
117 );
118HRESULT DAPI StrAllocFormattedArgsSecure(
119 __deref_out_z LPWSTR* ppwz,
120 __in __format_string LPCWSTR wzFormat,
121 __in va_list args
122 );
123HRESULT DAPI StrAnsiAllocFormattedArgs(
124 __deref_out_z LPSTR* ppsz,
125 __in __format_string LPCSTR szFormat,
126 __in va_list args
127 );
128HRESULT DAPI StrAllocFromError(
129 __inout LPWSTR *ppwzMessage,
130 __in HRESULT hrError,
131 __in_opt HMODULE hModule,
132 ...
133 );
134
135HRESULT DAPI StrMaxLength(
136 __in LPCVOID p,
137 __out DWORD_PTR* pcch
138 );
139HRESULT DAPI StrSize(
140 __in LPCVOID p,
141 __out DWORD_PTR* pcb
142 );
143
144HRESULT DAPI StrFree(
145 __in LPVOID p
146 );
147
148
149HRESULT DAPI StrReplaceStringAll(
150 __inout LPWSTR* ppwzOriginal,
151 __in_z LPCWSTR wzOldSubString,
152 __in_z LPCWSTR wzNewSubString
153 );
154HRESULT DAPI StrReplaceString(
155 __inout LPWSTR* ppwzOriginal,
156 __inout DWORD* pdwStartIndex,
157 __in_z LPCWSTR wzOldSubString,
158 __in_z LPCWSTR wzNewSubString
159 );
160
161HRESULT DAPI StrHexEncode(
162 __in_ecount(cbSource) const BYTE* pbSource,
163 __in DWORD_PTR cbSource,
164 __out_ecount(cchDest) LPWSTR wzDest,
165 __in DWORD_PTR cchDest
166 );
167HRESULT DAPI StrAllocHexEncode(
168 __in_ecount(cbSource) const BYTE* pbSource,
169 __in DWORD_PTR cbSource,
170 __deref_out_ecount_z(2*(cbSource+1)) LPWSTR* ppwzDest
171 );
172HRESULT DAPI StrHexDecode(
173 __in_z LPCWSTR wzSource,
174 __out_bcount(cbDest) BYTE* pbDest,
175 __in DWORD_PTR cbDest
176 );
177HRESULT DAPI StrAllocHexDecode(
178 __in_z LPCWSTR wzSource,
179 __out_bcount(*pcbDest) BYTE** ppbDest,
180 __out_opt DWORD* pcbDest
181 );
182
183HRESULT DAPI StrAllocBase85Encode(
184 __in_bcount_opt(cbSource) const BYTE* pbSource,
185 __in DWORD_PTR cbSource,
186 __deref_out_z LPWSTR* pwzDest
187 );
188HRESULT DAPI StrAllocBase85Decode(
189 __in_z LPCWSTR wzSource,
190 __deref_out_bcount(*pcbDest) BYTE** hbDest,
191 __out DWORD_PTR* pcbDest
192 );
193
194HRESULT DAPI MultiSzLen(
195 __in_ecount(*pcch) __nullnullterminated LPCWSTR pwzMultiSz,
196 __out DWORD_PTR* pcch
197 );
198HRESULT DAPI MultiSzPrepend(
199 __deref_inout_ecount(*pcchMultiSz) __nullnullterminated LPWSTR* ppwzMultiSz,
200 __inout_opt DWORD_PTR *pcchMultiSz,
201 __in __nullnullterminated LPCWSTR pwzInsert
202 );
203HRESULT DAPI MultiSzFindSubstring(
204 __in __nullnullterminated LPCWSTR pwzMultiSz,
205 __in __nullnullterminated LPCWSTR pwzSubstring,
206 __out_opt DWORD_PTR* pdwIndex,
207 __deref_opt_out_z LPCWSTR* ppwzFoundIn
208 );
209HRESULT DAPI MultiSzFindString(
210 __in __nullnullterminated LPCWSTR pwzMultiSz,
211 __in __nullnullterminated LPCWSTR pwzString,
212 __out_opt DWORD_PTR* pdwIndex,
213 __deref_opt_out __nullnullterminated LPCWSTR* ppwzFound
214 );
215HRESULT DAPI MultiSzRemoveString(
216 __deref_inout __nullnullterminated LPWSTR* ppwzMultiSz,
217 __in DWORD_PTR dwIndex
218 );
219HRESULT DAPI MultiSzInsertString(
220 __deref_inout_z LPWSTR* ppwzMultiSz,
221 __inout_opt DWORD_PTR *pcchMultiSz,
222 __in DWORD_PTR dwIndex,
223 __in_z LPCWSTR pwzInsert
224 );
225HRESULT DAPI MultiSzReplaceString(
226 __deref_inout __nullnullterminated LPWSTR* ppwzMultiSz,
227 __in DWORD_PTR dwIndex,
228 __in_z LPCWSTR pwzString
229 );
230
231LPCWSTR DAPI wcsistr(
232 __in_z LPCWSTR wzString,
233 __in_z LPCWSTR wzCharSet
234 );
235
236HRESULT DAPI StrStringToInt16(
237 __in_z LPCWSTR wzIn,
238 __in DWORD cchIn,
239 __out SHORT* psOut
240 );
241HRESULT DAPI StrStringToUInt16(
242 __in_z LPCWSTR wzIn,
243 __in DWORD cchIn,
244 __out USHORT* pusOut
245 );
246HRESULT DAPI StrStringToInt32(
247 __in_z LPCWSTR wzIn,
248 __in DWORD cchIn,
249 __out INT* piOut
250 );
251HRESULT DAPI StrStringToUInt32(
252 __in_z LPCWSTR wzIn,
253 __in DWORD cchIn,
254 __out UINT* puiOut
255 );
256HRESULT DAPI StrStringToInt64(
257 __in_z LPCWSTR wzIn,
258 __in DWORD cchIn,
259 __out LONGLONG* pllOut
260 );
261HRESULT DAPI StrStringToUInt64(
262 __in_z LPCWSTR wzIn,
263 __in DWORD cchIn,
264 __out ULONGLONG* pullOut
265 );
266void DAPI StrStringToUpper(
267 __inout_z LPWSTR wzIn
268 );
269void DAPI StrStringToLower(
270 __inout_z LPWSTR wzIn
271 );
272HRESULT DAPI StrAllocStringToUpperInvariant(
273 __deref_out_z LPWSTR* pscz,
274 __in_z LPCWSTR wzSource,
275 __in int cchSource
276 );
277HRESULT DAPI StrAllocStringToLowerInvariant(
278 __deref_out_z LPWSTR* pscz,
279 __in_z LPCWSTR wzSource,
280 __in int cchSource
281 );
282
283HRESULT DAPI StrArrayAllocString(
284 __deref_inout_ecount_opt(*pcStrArray) LPWSTR **prgsczStrArray,
285 __inout LPUINT pcStrArray,
286 __in_z LPCWSTR wzSource,
287 __in DWORD_PTR cchSource
288 );
289
290HRESULT DAPI StrArrayFree(
291 __in_ecount(cStrArray) LPWSTR *rgsczStrArray,
292 __in UINT cStrArray
293 );
294
295HRESULT DAPI StrSplitAllocArray(
296 __deref_inout_ecount_opt(*pcStrArray) LPWSTR **prgsczStrArray,
297 __inout LPUINT pcStrArray,
298 __in_z LPCWSTR wzSource,
299 __in_z LPCWSTR wzDelim
300 );
301
302HRESULT DAPI StrSecureZeroString(
303 __in LPWSTR pwz
304 );
305HRESULT DAPI StrSecureZeroFreeString(
306 __in LPWSTR pwz
307 );
308
309#ifdef __cplusplus
310}
311#endif
diff --git a/src/dutil/inc/svcutil.h b/src/dutil/inc/svcutil.h
new file mode 100644
index 00000000..80d6326c
--- /dev/null
+++ b/src/dutil/inc/svcutil.h
@@ -0,0 +1,21 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9
10#define ReleaseServiceHandle(h) if (h) { ::CloseServiceHandle(h); h = NULL; }
11
12
13HRESULT DAPI SvcQueryConfig(
14 __in SC_HANDLE sch,
15 __out QUERY_SERVICE_CONFIGW** ppConfig
16 );
17
18
19#ifdef __cplusplus
20}
21#endif
diff --git a/src/dutil/inc/thmutil.h b/src/dutil/inc/thmutil.h
new file mode 100644
index 00000000..5b3d4667
--- /dev/null
+++ b/src/dutil/inc/thmutil.h
@@ -0,0 +1,711 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ReleaseTheme(p) if (p) { ThemeFree(p); p = NULL; }
10
11typedef HRESULT(CALLBACK *PFNTHM_EVALUATE_VARIABLE_CONDITION)(
12 __in_z LPCWSTR wzCondition,
13 __out BOOL* pf,
14 __in_opt LPVOID pvContext
15 );
16typedef HRESULT(CALLBACK *PFNTHM_FORMAT_VARIABLE_STRING)(
17 __in_z LPCWSTR wzFormat,
18 __inout LPWSTR* psczOut,
19 __in_opt LPVOID pvContext
20 );
21typedef HRESULT(CALLBACK *PFNTHM_GET_VARIABLE_NUMERIC)(
22 __in_z LPCWSTR wzVariable,
23 __out LONGLONG* pllValue,
24 __in_opt LPVOID pvContext
25 );
26typedef HRESULT(CALLBACK *PFNTHM_SET_VARIABLE_NUMERIC)(
27 __in_z LPCWSTR wzVariable,
28 __in LONGLONG llValue,
29 __in_opt LPVOID pvContext
30 );
31typedef HRESULT(CALLBACK *PFNTHM_GET_VARIABLE_STRING)(
32 __in_z LPCWSTR wzVariable,
33 __inout LPWSTR* psczValue,
34 __in_opt LPVOID pvContext
35 );
36typedef HRESULT(CALLBACK *PFNTHM_SET_VARIABLE_STRING)(
37 __in_z LPCWSTR wzVariable,
38 __in_z_opt LPCWSTR wzValue,
39 __in_opt LPVOID pvContext
40 );
41
42typedef enum THEME_ACTION_TYPE
43{
44 THEME_ACTION_TYPE_BROWSE_DIRECTORY,
45 THEME_ACTION_TYPE_CHANGE_PAGE,
46 THEME_ACTION_TYPE_CLOSE_WINDOW,
47} THEME_ACTION_TYPE;
48
49typedef enum THEME_CONTROL_DATA
50{
51 THEME_CONTROL_DATA_HOVER = 1,
52} THEME_CONTROL_DATA;
53
54typedef enum THEME_CONTROL_TYPE
55{
56 THEME_CONTROL_TYPE_UNKNOWN,
57 THEME_CONTROL_TYPE_BILLBOARD,
58 THEME_CONTROL_TYPE_BUTTON,
59 THEME_CONTROL_TYPE_CHECKBOX,
60 THEME_CONTROL_TYPE_COMBOBOX,
61 THEME_CONTROL_TYPE_COMMANDLINK,
62 THEME_CONTROL_TYPE_EDITBOX,
63 THEME_CONTROL_TYPE_HYPERLINK,
64 THEME_CONTROL_TYPE_HYPERTEXT,
65 THEME_CONTROL_TYPE_IMAGE,
66 THEME_CONTROL_TYPE_LABEL,
67 THEME_CONTROL_TYPE_PANEL,
68 THEME_CONTROL_TYPE_PROGRESSBAR,
69 THEME_CONTROL_TYPE_RADIOBUTTON,
70 THEME_CONTROL_TYPE_RICHEDIT,
71 THEME_CONTROL_TYPE_STATIC,
72 THEME_CONTROL_TYPE_LISTVIEW,
73 THEME_CONTROL_TYPE_TREEVIEW,
74 THEME_CONTROL_TYPE_TAB,
75} THEME_CONTROL_TYPE;
76
77typedef enum THEME_SHOW_PAGE_REASON
78{
79 THEME_SHOW_PAGE_REASON_DEFAULT,
80 THEME_SHOW_PAGE_REASON_CANCEL,
81 THEME_SHOW_PAGE_REASON_REFRESH,
82} THEME_SHOW_PAGE_REASON;
83
84
85struct THEME_COLUMN
86{
87 LPWSTR pszName;
88 UINT uStringId;
89 int nBaseWidth;
90 int nWidth;
91 BOOL fExpands;
92};
93
94
95struct THEME_TAB
96{
97 LPWSTR pszName;
98 UINT uStringId;
99};
100
101struct THEME_ACTION
102{
103 LPWSTR sczCondition;
104 THEME_ACTION_TYPE type;
105 union
106 {
107 struct
108 {
109 LPWSTR sczVariableName;
110 } BrowseDirectory;
111 struct
112 {
113 LPWSTR sczPageName;
114 BOOL fCancel;
115 } ChangePage;
116 };
117};
118
119struct THEME_CONDITIONAL_TEXT
120{
121 LPWSTR sczCondition;
122 LPWSTR sczText;
123};
124
125// THEME_ASSIGN_CONTROL_ID - Used to apply a specific id to a named control (usually
126// to set the WM_COMMAND).
127struct THEME_ASSIGN_CONTROL_ID
128{
129 WORD wId; // id to apply to control
130 LPCWSTR wzName; // name of control to match
131};
132
133const DWORD THEME_FIRST_ASSIGN_CONTROL_ID = 1024; // Recommended first control id to be assigned.
134
135struct THEME_CONTROL
136{
137 THEME_CONTROL_TYPE type;
138
139 WORD wId;
140 WORD wPageId;
141
142 LPWSTR sczName; // optional name for control, used to apply control id and link the control to a variable.
143 LPWSTR sczText;
144 LPWSTR sczTooltip;
145 LPWSTR sczNote; // optional text for command link
146 int nX;
147 int nY;
148 int nHeight;
149 int nWidth;
150 int nSourceX;
151 int nSourceY;
152 UINT uStringId;
153
154 LPWSTR sczEnableCondition;
155 LPWSTR sczVisibleCondition;
156 BOOL fDisableVariableFunctionality;
157
158 HBITMAP hImage;
159 HICON hIcon;
160
161 // Don't free these; it's just a handle to the central image lists stored in THEME. The handle is freed once, there.
162 HIMAGELIST rghImageList[4];
163
164 DWORD dwStyle;
165 DWORD dwExtendedStyle;
166 DWORD dwInternalStyle;
167
168 DWORD dwFontId;
169
170 // child controls
171 DWORD cControls;
172 THEME_CONTROL* rgControls;
173
174 // Used by billboard controls
175 WORD wBillboardInterval;
176 BOOL fBillboardLoops;
177
178 // Used by button and command link controls
179 THEME_ACTION* rgActions;
180 DWORD cActions;
181 THEME_ACTION* pDefaultAction;
182
183 // Used by hyperlink and owner-drawn button controls
184 DWORD dwFontHoverId;
185 DWORD dwFontSelectedId;
186
187 // Used by listview controls
188 THEME_COLUMN *ptcColumns;
189 DWORD cColumns;
190
191 // Used by radio button controls
192 BOOL fLastRadioButton;
193 LPWSTR sczValue;
194 LPWSTR sczVariable;
195
196 // Used by tab controls
197 THEME_TAB *pttTabs;
198 DWORD cTabs;
199
200 // Used by controls that have text
201 DWORD cConditionalText;
202 THEME_CONDITIONAL_TEXT* rgConditionalText;
203
204 // Used by command link controls
205 DWORD cConditionalNotes;
206 THEME_CONDITIONAL_TEXT* rgConditionalNotes;
207
208 // state variables that should be ignored
209 HWND hWnd;
210 DWORD dwData; // type specific data
211};
212
213
214struct THEME_IMAGELIST
215{
216 LPWSTR sczName;
217
218 HIMAGELIST hImageList;
219};
220
221struct THEME_SAVEDVARIABLE
222{
223 LPWSTR wzName;
224 LPWSTR sczValue;
225};
226
227struct THEME_PAGE
228{
229 WORD wId;
230 LPWSTR sczName;
231
232 DWORD cControlIndices;
233
234 DWORD cSavedVariables;
235 THEME_SAVEDVARIABLE* rgSavedVariables;
236};
237
238struct THEME_FONT
239{
240 HFONT hFont;
241 COLORREF crForeground;
242 HBRUSH hForeground;
243 COLORREF crBackground;
244 HBRUSH hBackground;
245};
246
247
248struct THEME
249{
250 WORD wId;
251
252 BOOL fAutoResize;
253
254 DWORD dwStyle;
255 DWORD dwFontId;
256 HANDLE hIcon;
257 LPWSTR sczCaption;
258 int nHeight;
259 int nMinimumHeight;
260 int nWidth;
261 int nMinimumWidth;
262 int nSourceX;
263 int nSourceY;
264 UINT uStringId;
265
266 HBITMAP hImage;
267
268 DWORD cFonts;
269 THEME_FONT* rgFonts;
270
271 DWORD cPages;
272 THEME_PAGE* rgPages;
273
274 DWORD cImageLists;
275 THEME_IMAGELIST* rgImageLists;
276
277 DWORD cControls;
278 THEME_CONTROL* rgControls;
279
280 // internal state variables -- do not use outside ThmUtil.cpp
281 HWND hwndParent; // parent for loaded controls
282 HWND hwndHover; // current hwnd hovered over
283 DWORD dwCurrentPageId;
284 HWND hwndTooltip;
285
286 // callback functions
287 PFNTHM_EVALUATE_VARIABLE_CONDITION pfnEvaluateCondition;
288 PFNTHM_FORMAT_VARIABLE_STRING pfnFormatString;
289 PFNTHM_GET_VARIABLE_NUMERIC pfnGetNumericVariable;
290 PFNTHM_SET_VARIABLE_NUMERIC pfnSetNumericVariable;
291 PFNTHM_GET_VARIABLE_STRING pfnGetStringVariable;
292 PFNTHM_SET_VARIABLE_STRING pfnSetStringVariable;
293
294 LPVOID pvVariableContext;
295};
296
297
298/********************************************************************
299 ThemeInitialize - initialized theme management.
300
301*******************************************************************/
302DAPI_(HRESULT) ThemeInitialize(
303 __in_opt HMODULE hModule
304 );
305
306/********************************************************************
307 ThemeUninitialize - uninitialize theme management.
308
309*******************************************************************/
310DAPI_(void) ThemeUninitialize();
311
312/********************************************************************
313 ThemeLoadFromFile - loads a theme from a loose file.
314
315 *******************************************************************/
316DAPI_(HRESULT) ThemeLoadFromFile(
317 __in_z LPCWSTR wzThemeFile,
318 __out THEME** ppTheme
319 );
320
321/********************************************************************
322 ThemeLoadFromResource - loads a theme from a module's data resource.
323
324 NOTE: The resource data must be UTF-8 encoded.
325*******************************************************************/
326DAPI_(HRESULT) ThemeLoadFromResource(
327 __in_opt HMODULE hModule,
328 __in_z LPCSTR szResource,
329 __out THEME** ppTheme
330 );
331
332/********************************************************************
333 ThemeFree - frees any memory associated with a theme.
334
335*******************************************************************/
336DAPI_(void) ThemeFree(
337 __in THEME* pTheme
338 );
339
340/********************************************************************
341ThemeRegisterVariableCallbacks - registers a context and callbacks
342 for working with variables.
343
344*******************************************************************/
345DAPI_(HRESULT) ThemeRegisterVariableCallbacks(
346 __in THEME* pTheme,
347 __in_opt PFNTHM_EVALUATE_VARIABLE_CONDITION pfnEvaluateCondition,
348 __in_opt PFNTHM_FORMAT_VARIABLE_STRING pfnFormatString,
349 __in_opt PFNTHM_GET_VARIABLE_NUMERIC pfnGetNumericVariable,
350 __in_opt PFNTHM_SET_VARIABLE_NUMERIC pfnSetNumericVariable,
351 __in_opt PFNTHM_GET_VARIABLE_STRING pfnGetStringVariable,
352 __in_opt PFNTHM_SET_VARIABLE_STRING pfnSetStringVariable,
353 __in_opt LPVOID pvContext
354 );
355
356/********************************************************************
357 ThemeLoadControls - creates the windows for all the theme controls.
358
359*******************************************************************/
360DAPI_(HRESULT) ThemeLoadControls(
361 __in THEME* pTheme,
362 __in HWND hwndParent,
363 __in_ecount_opt(cAssignControlIds) const THEME_ASSIGN_CONTROL_ID* rgAssignControlIds,
364 __in DWORD cAssignControlIds
365 );
366
367/********************************************************************
368 ThemeUnloadControls - resets all the theme control windows so the theme
369 controls can be reloaded.
370
371*******************************************************************/
372DAPI_(void) ThemeUnloadControls(
373 __in THEME* pTheme
374 );
375
376/********************************************************************
377 ThemeLocalize - Localizes all of the strings in the theme.
378
379*******************************************************************/
380DAPI_(HRESULT) ThemeLocalize(
381 __in THEME *pTheme,
382 __in const WIX_LOCALIZATION *pLocStringSet
383 );
384
385DAPI_(HRESULT) ThemeLoadStrings(
386 __in THEME* pTheme,
387 __in HMODULE hResModule
388 );
389
390/********************************************************************
391 ThemeLoadRichEditFromFile - Attach a richedit control to a RTF file.
392
393 *******************************************************************/
394DAPI_(HRESULT) ThemeLoadRichEditFromFile(
395 __in THEME* pTheme,
396 __in DWORD dwControl,
397 __in_z LPCWSTR wzFileName,
398 __in HMODULE hModule
399 );
400
401/********************************************************************
402 ThemeLoadRichEditFromResource - Attach a richedit control to resource data.
403
404 *******************************************************************/
405DAPI_(HRESULT) ThemeLoadRichEditFromResource(
406 __in THEME* pTheme,
407 __in DWORD dwControl,
408 __in_z LPCSTR szResourceName,
409 __in HMODULE hModule
410 );
411
412/********************************************************************
413 ThemeLoadRichEditFromResourceToHWnd - Attach a richedit control (by
414 HWND) to resource data.
415
416 *******************************************************************/
417DAPI_(HRESULT) ThemeLoadRichEditFromResourceToHWnd(
418 __in HWND hWnd,
419 __in_z LPCSTR szResourceName,
420 __in HMODULE hModule
421 );
422
423/********************************************************************
424 ThemeHandleKeyboardMessage - will translate the message using the active
425 accelerator table.
426
427*******************************************************************/
428DAPI_(BOOL) ThemeHandleKeyboardMessage(
429 __in_opt THEME* pTheme,
430 __in HWND hWnd,
431 __in MSG* pMsg
432 );
433
434/********************************************************************
435 ThemeDefWindowProc - replacement for DefWindowProc() when using theme.
436
437*******************************************************************/
438LRESULT CALLBACK ThemeDefWindowProc(
439 __in_opt THEME* pTheme,
440 __in HWND hWnd,
441 __in UINT uMsg,
442 __in WPARAM wParam,
443 __in LPARAM lParam
444 );
445
446/********************************************************************
447 ThemeGetPageIds - gets the page ids for the theme via page names.
448
449*******************************************************************/
450DAPI_(void) ThemeGetPageIds(
451 __in const THEME* pTheme,
452 __in_ecount(cGetPages) LPCWSTR* rgwzFindNames,
453 __inout_ecount(cGetPages) DWORD* rgdwPageIds,
454 __in DWORD cGetPages
455 );
456
457/********************************************************************
458 ThemeGetPage - gets a theme page by id.
459
460 *******************************************************************/
461DAPI_(THEME_PAGE*) ThemeGetPage(
462 __in const THEME* pTheme,
463 __in DWORD dwPage
464 );
465
466/********************************************************************
467 ThemeShowPage - shows or hides all of the controls in the page at one time.
468
469 *******************************************************************/
470DAPI_(HRESULT) ThemeShowPage(
471 __in THEME* pTheme,
472 __in DWORD dwPage,
473 __in int nCmdShow
474 );
475
476/********************************************************************
477ThemeShowPageEx - shows or hides all of the controls in the page at one time.
478 When using variables, TSPR_CANCEL reverts any changes made.
479 TSPR_REFRESH forces reevaluation of conditions.
480 It is expected that the current page is hidden before
481 showing a new page.
482
483*******************************************************************/
484DAPI_(HRESULT) ThemeShowPageEx(
485 __in THEME* pTheme,
486 __in DWORD dwPage,
487 __in int nCmdShow,
488 __in THEME_SHOW_PAGE_REASON reason
489 );
490
491
492/********************************************************************
493ThemeShowChild - shows a control's specified child control, hiding the rest.
494
495*******************************************************************/
496DAPI_(void) ThemeShowChild(
497 __in THEME* pTheme,
498 __in THEME_CONTROL* pParentControl,
499 __in DWORD dwIndex
500 );
501
502/********************************************************************
503 ThemeControlExists - check if a control with the specified id exists.
504
505 *******************************************************************/
506DAPI_(BOOL) ThemeControlExists(
507 __in const THEME* pTheme,
508 __in DWORD dwControl
509 );
510
511/********************************************************************
512 ThemeControlEnable - enables/disables a control.
513
514 *******************************************************************/
515DAPI_(void) ThemeControlEnable(
516 __in THEME* pTheme,
517 __in DWORD dwControl,
518 __in BOOL fEnable
519 );
520
521/********************************************************************
522 ThemeControlEnabled - returns whether a control is enabled/disabled.
523
524 *******************************************************************/
525DAPI_(BOOL) ThemeControlEnabled(
526 __in THEME* pTheme,
527 __in DWORD dwControl
528 );
529
530/********************************************************************
531 ThemeControlElevates - sets/removes the shield icon on a control.
532
533 *******************************************************************/
534DAPI_(void) ThemeControlElevates(
535 __in THEME* pTheme,
536 __in DWORD dwControl,
537 __in BOOL fElevates
538 );
539
540/********************************************************************
541 ThemeShowControl - shows/hides a control.
542
543 *******************************************************************/
544DAPI_(void) ThemeShowControl(
545 __in THEME* pTheme,
546 __in DWORD dwControl,
547 __in int nCmdShow
548 );
549
550/********************************************************************
551ThemeShowControlEx - shows/hides a control with support for
552conditional text and notes.
553
554*******************************************************************/
555DAPI_(void) ThemeShowControlEx(
556 __in THEME* pTheme,
557 __in DWORD dwControl,
558 __in int nCmdShow
559 );
560
561/********************************************************************
562 ThemeControlVisible - returns whether a control is visible.
563
564 *******************************************************************/
565DAPI_(BOOL) ThemeControlVisible(
566 __in THEME* pTheme,
567 __in DWORD dwControl
568 );
569
570DAPI_(BOOL) ThemePostControlMessage(
571 __in THEME* pTheme,
572 __in DWORD dwControl,
573 __in UINT Msg,
574 __in WPARAM wParam,
575 __in LPARAM lParam
576 );
577
578DAPI_(LRESULT) ThemeSendControlMessage(
579 __in const THEME* pTheme,
580 __in DWORD dwControl,
581 __in UINT Msg,
582 __in WPARAM wParam,
583 __in LPARAM lParam
584 );
585
586/********************************************************************
587 ThemeDrawBackground - draws the theme background.
588
589*******************************************************************/
590DAPI_(HRESULT) ThemeDrawBackground(
591 __in THEME* pTheme,
592 __in PAINTSTRUCT* pps
593 );
594
595/********************************************************************
596 ThemeDrawControl - draw an owner drawn control.
597
598*******************************************************************/
599DAPI_(HRESULT) ThemeDrawControl(
600 __in THEME* pTheme,
601 __in DRAWITEMSTRUCT* pdis
602 );
603
604/********************************************************************
605 ThemeHoverControl - mark a control as hover.
606
607*******************************************************************/
608DAPI_(BOOL) ThemeHoverControl(
609 __in THEME* pTheme,
610 __in HWND hwndParent,
611 __in HWND hwndControl
612 );
613
614/********************************************************************
615 ThemeIsControlChecked - gets whether a control is checked. Only
616 really useful for checkbox controls.
617
618*******************************************************************/
619DAPI_(BOOL) ThemeIsControlChecked(
620 __in THEME* pTheme,
621 __in DWORD dwControl
622 );
623
624/********************************************************************
625 ThemeSetControlColor - sets the color of text for a control.
626
627*******************************************************************/
628DAPI_(BOOL) ThemeSetControlColor(
629 __in THEME* pTheme,
630 __in HDC hdc,
631 __in HWND hWnd,
632 __out HBRUSH* phBackgroundBrush
633 );
634
635/********************************************************************
636 ThemeSetProgressControl - sets the current percentage complete in a
637 progress bar control.
638
639*******************************************************************/
640DAPI_(HRESULT) ThemeSetProgressControl(
641 __in THEME* pTheme,
642 __in DWORD dwControl,
643 __in DWORD dwProgressPercentage
644 );
645
646/********************************************************************
647 ThemeSetProgressControlColor - sets the current color of a
648 progress bar control.
649
650*******************************************************************/
651DAPI_(HRESULT) ThemeSetProgressControlColor(
652 __in THEME* pTheme,
653 __in DWORD dwControl,
654 __in DWORD dwColorIndex
655 );
656
657/********************************************************************
658 ThemeSetTextControl - sets the text of a control.
659
660*******************************************************************/
661DAPI_(HRESULT) ThemeSetTextControl(
662 __in const THEME* pTheme,
663 __in DWORD dwControl,
664 __in_z_opt LPCWSTR wzText
665 );
666
667/********************************************************************
668ThemeSetTextControl - sets the text of a control and optionally
669 invalidates the control.
670
671*******************************************************************/
672DAPI_(HRESULT) ThemeSetTextControlEx(
673 __in const THEME* pTheme,
674 __in DWORD dwControl,
675 __in BOOL fUpdate,
676 __in_z_opt LPCWSTR wzText
677 );
678
679/********************************************************************
680 ThemeGetTextControl - gets the text of a control.
681
682*******************************************************************/
683DAPI_(HRESULT) ThemeGetTextControl(
684 __in const THEME* pTheme,
685 __in DWORD dwControl,
686 __out_z LPWSTR* psczText
687 );
688
689/********************************************************************
690 ThemeUpdateCaption - updates the caption in the theme.
691
692*******************************************************************/
693DAPI_(HRESULT) ThemeUpdateCaption(
694 __in THEME* pTheme,
695 __in_z LPCWSTR wzCaption
696 );
697
698/********************************************************************
699 ThemeSetFocus - set the focus to the control supplied or the next
700 enabled control if it is disabled.
701
702*******************************************************************/
703DAPI_(void) ThemeSetFocus(
704 __in THEME* pTheme,
705 __in DWORD dwControl
706 );
707
708#ifdef __cplusplus
709}
710#endif
711
diff --git a/src/dutil/inc/timeutil.h b/src/dutil/inc/timeutil.h
new file mode 100644
index 00000000..3655c00a
--- /dev/null
+++ b/src/dutil/inc/timeutil.h
@@ -0,0 +1,38 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9HRESULT DAPI TimeFromString(
10 __in_z LPCWSTR wzTime,
11 __out FILETIME* pFileTime
12 );
13HRESULT DAPI TimeFromString3339(
14 __in_z LPCWSTR wzTime,
15 __out FILETIME* pFileTime
16 );
17HRESULT DAPI TimeCurrentTime(
18 __deref_out_z LPWSTR* ppwz,
19 __in BOOL fGMT
20 );
21HRESULT DAPI TimeCurrentDateTime(
22 __deref_out_z LPWSTR* ppwz,
23 __in BOOL fGMT
24 );
25HRESULT DAPI TimeSystemDateTime(
26 __deref_out_z LPWSTR* ppwz,
27 __in const SYSTEMTIME *pst,
28 __in BOOL fGMT
29 );
30HRESULT DAPI TimeSystemToDateTimeString(
31 __deref_out_z LPWSTR* ppwz,
32 __in const SYSTEMTIME *pst,
33 __in LCID locale
34 );
35
36#ifdef __cplusplus
37}
38#endif
diff --git a/src/dutil/inc/uncutil.h b/src/dutil/inc/uncutil.h
new file mode 100644
index 00000000..6516a801
--- /dev/null
+++ b/src/dutil/inc/uncutil.h
@@ -0,0 +1,20 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9/*******************************************************************
10 UncConvertFromMountedDrive - Converts the string in-place from a
11 mounted drive path to a UNC path
12*******************************************************************/
13DAPI_(HRESULT) UncConvertFromMountedDrive(
14 __inout LPWSTR *psczUNCPath,
15 __in LPCWSTR sczMountedDrivePath
16 );
17
18#ifdef __cplusplus
19}
20#endif
diff --git a/src/dutil/inc/uriutil.h b/src/dutil/inc/uriutil.h
new file mode 100644
index 00000000..52e78308
--- /dev/null
+++ b/src/dutil/inc/uriutil.h
@@ -0,0 +1,100 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include "wininet.h"
6
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12typedef enum URI_PROTOCOL
13{
14 URI_PROTOCOL_UNKNOWN,
15 URI_PROTOCOL_FILE,
16 URI_PROTOCOL_FTP,
17 URI_PROTOCOL_HTTP,
18 URI_PROTOCOL_HTTPS,
19 URI_PROTOCOL_LOCAL,
20 URI_PROTOCOL_UNC
21} URI_PROTOCOL;
22
23typedef struct _URI_INFO
24{
25 INTERNET_SCHEME scheme;
26 LPWSTR sczHostName;
27 INTERNET_PORT port;
28 LPWSTR sczUser;
29 LPWSTR sczPassword;
30 LPWSTR sczPath;
31 LPWSTR sczQueryString;
32} URI_INFO;
33
34
35HRESULT DAPI UriCanonicalize(
36 __inout_z LPWSTR* psczUri
37 );
38
39HRESULT DAPI UriCrack(
40 __in_z LPCWSTR wzUri,
41 __out_opt INTERNET_SCHEME* pScheme,
42 __deref_opt_out_z LPWSTR* psczHostName,
43 __out_opt INTERNET_PORT* pPort,
44 __deref_opt_out_z LPWSTR* psczUser,
45 __deref_opt_out_z LPWSTR* psczPassword,
46 __deref_opt_out_z LPWSTR* psczPath,
47 __deref_opt_out_z LPWSTR* psczQueryString
48 );
49
50HRESULT DAPI UriCrackEx(
51 __in_z LPCWSTR wzUri,
52 __in URI_INFO* pUriInfo
53 );
54
55void DAPI UriInfoUninitialize(
56 __in URI_INFO* pUriInfo
57 );
58
59HRESULT DAPI UriCreate(
60 __inout_z LPWSTR* psczUri,
61 __in INTERNET_SCHEME scheme,
62 __in_z_opt LPWSTR wzHostName,
63 __in INTERNET_PORT port,
64 __in_z_opt LPWSTR wzUser,
65 __in_z_opt LPWSTR wzPassword,
66 __in_z_opt LPWSTR wzPath,
67 __in_z_opt LPWSTR wzQueryString
68 );
69
70HRESULT DAPI UriCanonicalize(
71 __inout_z LPWSTR* psczUri
72 );
73
74HRESULT DAPI UriFile(
75 __deref_out_z LPWSTR* psczFile,
76 __in_z LPCWSTR wzUri
77 );
78
79HRESULT DAPI UriProtocol(
80 __in_z LPCWSTR wzUri,
81 __out URI_PROTOCOL* pProtocol
82 );
83
84HRESULT DAPI UriRoot(
85 __in_z LPCWSTR wzUri,
86 __out LPWSTR* ppwzRoot,
87 __out_opt URI_PROTOCOL* pProtocol
88 );
89
90HRESULT DAPI UriResolve(
91 __in_z LPCWSTR wzUri,
92 __in_opt LPCWSTR wzBaseUri,
93 __out LPWSTR* ppwzResolvedUri,
94 __out_opt const URI_PROTOCOL* pResolvedProtocol
95 );
96
97#ifdef __cplusplus
98}
99#endif
100
diff --git a/src/dutil/inc/userutil.h b/src/dutil/inc/userutil.h
new file mode 100644
index 00000000..2c86d229
--- /dev/null
+++ b/src/dutil/inc/userutil.h
@@ -0,0 +1,32 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9HRESULT DAPI UserBuildDomainUserName(
10 __out_ecount_z(cchDest) LPWSTR wzDest,
11 __in int cchDest,
12 __in_z LPCWSTR pwzName,
13 __in_z LPCWSTR pwzDomain
14 );
15
16HRESULT DAPI UserCheckIsMember(
17 __in_z LPCWSTR pwzName,
18 __in_z LPCWSTR pwzDomain,
19 __in_z LPCWSTR pwzGroupName,
20 __in_z LPCWSTR pwzGroupDomain,
21 __out LPBOOL lpfMember
22 );
23
24HRESULT DAPI UserCreateADsPath(
25 __in_z LPCWSTR wzObjectDomain,
26 __in_z LPCWSTR wzObjectName,
27 __out BSTR *pbstrAdsPath
28 );
29
30#ifdef __cplusplus
31}
32#endif
diff --git a/src/dutil/inc/varutil.h b/src/dutil/inc/varutil.h
new file mode 100644
index 00000000..86d0aca0
--- /dev/null
+++ b/src/dutil/inc/varutil.h
@@ -0,0 +1,126 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#if defined(__cplusplus)
6extern "C" {
7#endif
8
9#define ReleaseVariables(vh) if (vh) { VarDestroy(vh, NULL); }
10#define ReleaseVariableValue(v) if (v) { VarFreeValue(v); }
11#define ReleaseNullVariables(vh) if (vh) { VarDestroy(vh, NULL); vh = NULL; }
12#define ReleaseNullVariableValue(v) if (v) { VarFreeValue(v); v = NULL; }
13
14typedef void* VARIABLE_ENUM_HANDLE;
15typedef void* VARIABLES_HANDLE;
16typedef const void* C_VARIABLES_HANDLE;
17
18extern const int VARIABLE_ENUM_HANDLE_BYTES;
19extern const int VARIABLES_HANDLE_BYTES;
20
21typedef void(*PFN_FREEVARIABLECONTEXT)(
22 __in LPVOID pvContext
23 );
24
25typedef enum VARIABLE_VALUE_TYPE
26{
27 VARIABLE_VALUE_TYPE_NONE,
28 VARIABLE_VALUE_TYPE_NUMERIC,
29 VARIABLE_VALUE_TYPE_STRING,
30 VARIABLE_VALUE_TYPE_VERSION,
31} VARIABLE_VALUE_TYPE;
32
33typedef struct _VARIABLE_VALUE
34{
35 VARIABLE_VALUE_TYPE type;
36 union
37 {
38 LONGLONG llValue;
39 DWORD64 qwValue;
40 LPWSTR sczValue;
41 };
42 BOOL fHidden;
43 LPVOID pvContext;
44} VARIABLE_VALUE;
45
46HRESULT DAPI VarCreate(
47 __out_bcount(VARIABLES_HANDLE_BYTES) VARIABLES_HANDLE* ppVariables
48 );
49void DAPI VarDestroy(
50 __in_bcount(VARIABLES_HANDLE_BYTES) VARIABLES_HANDLE pVariables,
51 __in_opt PFN_FREEVARIABLECONTEXT vpfFreeVariableContext
52 );
53void DAPI VarFreeValue(
54 __in VARIABLE_VALUE* pValue
55 );
56HRESULT DAPI VarEscapeString(
57 __in_z LPCWSTR wzIn,
58 __out_z LPWSTR* psczOut
59 );
60HRESULT DAPI VarFormatString(
61 __in C_VARIABLES_HANDLE pVariables,
62 __in_z LPCWSTR wzIn,
63 __out_z_opt LPWSTR* psczOut,
64 __out_opt DWORD* pcchOut
65 );
66HRESULT DAPI VarGetFormatted(
67 __in C_VARIABLES_HANDLE pVariables,
68 __in_z LPCWSTR wzVariable,
69 __out_z LPWSTR* psczValue
70 );
71HRESULT DAPI VarGetNumeric(
72 __in C_VARIABLES_HANDLE pVariables,
73 __in_z LPCWSTR wzVariable,
74 __out LONGLONG* pllValue
75 );
76HRESULT DAPI VarGetString(
77 __in C_VARIABLES_HANDLE pVariables,
78 __in_z LPCWSTR wzVariable,
79 __out_z LPWSTR* psczValue
80 );
81HRESULT DAPI VarGetVersion(
82 __in C_VARIABLES_HANDLE pVariables,
83 __in_z LPCWSTR wzVariable,
84 __in DWORD64* pqwValue
85 );
86HRESULT DAPI VarGetValue(
87 __in C_VARIABLES_HANDLE pVariables,
88 __in_z LPCWSTR wzVariable,
89 __out VARIABLE_VALUE** ppValue
90 );
91HRESULT DAPI VarSetNumeric(
92 __in VARIABLES_HANDLE pVariables,
93 __in_z LPCWSTR wzVariable,
94 __in LONGLONG llValue
95 );
96HRESULT DAPI VarSetString(
97 __in VARIABLES_HANDLE pVariables,
98 __in_z LPCWSTR wzVariable,
99 __in_z_opt LPCWSTR wzValue
100 );
101HRESULT DAPI VarSetVersion(
102 __in VARIABLES_HANDLE pVariables,
103 __in_z LPCWSTR wzVariable,
104 __in DWORD64 qwValue
105 );
106HRESULT DAPI VarSetValue(
107 __in VARIABLES_HANDLE pVariables,
108 __in_z LPCWSTR wzVariable,
109 __in VARIABLE_VALUE* pValue
110 );
111HRESULT DAPI VarStartEnum(
112 __in VARIABLES_HANDLE pVariables,
113 __out_bcount(VARIABLE_ENUM_HANDLE_BYTES) VARIABLE_ENUM_HANDLE* ppEnum,
114 __out VARIABLE_VALUE** ppValue
115 );
116HRESULT DAPI VarNextVariable(
117 __in_bcount(VARIABLE_ENUM_HANDLE_BYTES) VARIABLE_ENUM_HANDLE pEnum,
118 __out VARIABLE_VALUE** ppValue
119 );
120void DAPI VarFinishEnum(
121 __in_bcount(VARIABLE_ENUM_HANDLE_BYTES) VARIABLE_ENUM_HANDLE pEnum
122 );
123
124#if defined(__cplusplus)
125}
126#endif
diff --git a/src/dutil/inc/wiutil.h b/src/dutil/inc/wiutil.h
new file mode 100644
index 00000000..4264b815
--- /dev/null
+++ b/src/dutil/inc/wiutil.h
@@ -0,0 +1,373 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9// constants
10
11#define IDNOACTION 0
12#define WIU_MB_OKIGNORECANCELRETRY 0xE
13
14#define MAX_DARWIN_KEY 73
15#define MAX_DARWIN_COLUMN 255
16
17#define WIU_LOG_DEFAULT INSTALLLOGMODE_FATALEXIT | INSTALLLOGMODE_ERROR | INSTALLLOGMODE_WARNING | \
18 INSTALLLOGMODE_USER | INSTALLLOGMODE_INFO | INSTALLLOGMODE_RESOLVESOURCE | \
19 INSTALLLOGMODE_OUTOFDISKSPACE | INSTALLLOGMODE_ACTIONSTART | \
20 INSTALLLOGMODE_ACTIONDATA | INSTALLLOGMODE_COMMONDATA | INSTALLLOGMODE_PROPERTYDUMP
21
22#define ReleaseMsi(h) if (h) { ::MsiCloseHandle(h); }
23#define ReleaseNullMsi(h) if (h) { ::MsiCloseHandle(h); h = NULL; }
24
25
26typedef enum WIU_RESTART
27{
28 WIU_RESTART_NONE,
29 WIU_RESTART_REQUIRED,
30 WIU_RESTART_INITIATED,
31} WIU_RESTART;
32
33typedef enum WIU_MSI_EXECUTE_MESSAGE_TYPE
34{
35 WIU_MSI_EXECUTE_MESSAGE_NONE,
36 WIU_MSI_EXECUTE_MESSAGE_PROGRESS,
37 WIU_MSI_EXECUTE_MESSAGE_ERROR,
38 WIU_MSI_EXECUTE_MESSAGE_MSI_MESSAGE,
39 WIU_MSI_EXECUTE_MESSAGE_MSI_FILES_IN_USE,
40} WIU_MSI_EXECUTE_MESSAGE_TYPE;
41
42
43// structures
44
45typedef struct _WIU_MSI_EXECUTE_MESSAGE
46{
47 WIU_MSI_EXECUTE_MESSAGE_TYPE type;
48 DWORD dwAllowedResults;
49
50 DWORD cData;
51 LPCWSTR* rgwzData;
52
53 INT nResultRecommendation; // recommended return result for this message based on analysis of real world installs.
54
55 union
56 {
57 struct
58 {
59 DWORD dwPercentage;
60 } progress;
61 struct
62 {
63 DWORD dwErrorCode;
64 LPCWSTR wzMessage;
65 } error;
66 struct
67 {
68 INSTALLMESSAGE mt;
69 LPCWSTR wzMessage;
70 } msiMessage;
71 struct
72 {
73 DWORD cFiles;
74 LPCWSTR* rgwzFiles;
75 } msiFilesInUse;
76 };
77} WIU_MSI_EXECUTE_MESSAGE;
78
79typedef struct _WIU_MSI_PROGRESS
80{
81 DWORD dwTotal;
82 DWORD dwCompleted;
83 DWORD dwStep;
84 BOOL fMoveForward;
85 BOOL fEnableActionData;
86 BOOL fScriptInProgress;
87} WIU_MSI_PROGRESS;
88
89
90typedef int (*PFN_MSIEXECUTEMESSAGEHANDLER)(
91 __in WIU_MSI_EXECUTE_MESSAGE* pMessage,
92 __in_opt LPVOID pvContext
93 );
94
95typedef struct _WIU_MSI_EXECUTE_CONTEXT
96{
97 BOOL fRollback;
98 PFN_MSIEXECUTEMESSAGEHANDLER pfnMessageHandler;
99 LPVOID pvContext;
100 WIU_MSI_PROGRESS rgMsiProgress[64];
101 DWORD dwCurrentProgressIndex;
102
103 INSTALLUILEVEL previousInstallUILevel;
104 HWND hwndPreviousParentWindow;
105 INSTALLUI_HANDLERW pfnPreviousExternalUI;
106 INSTALLUI_HANDLER_RECORD pfnPreviousExternalUIRecord;
107
108 BOOL fSetPreviousExternalUIRecord;
109 BOOL fSetPreviousExternalUI;
110} WIU_MSI_EXECUTE_CONTEXT;
111
112
113// typedefs
114typedef UINT (WINAPI *PFN_MSIENABLELOGW)(
115 __in DWORD dwLogMode,
116 __in_z LPCWSTR szLogFile,
117 __in DWORD dwLogAttributes
118 );
119typedef UINT (WINAPI *PFN_MSIGETPRODUCTINFOW)(
120 __in LPCWSTR szProductCode,
121 __in LPCWSTR szProperty,
122 __out_ecount_opt(*pcchValue) LPWSTR szValue,
123 __inout LPDWORD pcchValue
124 );
125typedef INSTALLSTATE (WINAPI *PFN_MSIGETCOMPONENTPATHW)(
126 __in LPCWSTR szProduct,
127 __in LPCWSTR szComponent,
128 __out_ecount_opt(*pcchBuf) LPWSTR lpPathBuf,
129 __inout_opt LPDWORD pcchBuf
130 );
131typedef INSTALLSTATE (WINAPI *PFN_MSILOCATECOMPONENTW)(
132 __in LPCWSTR szComponent,
133 __out_ecount_opt(*pcchBuf) LPWSTR lpPathBuf,
134 __inout_opt LPDWORD pcchBuf
135 );
136typedef UINT (WINAPI *PFN_MSIGETPRODUCTINFOEXW)(
137 __in LPCWSTR szProductCode,
138 __in_opt LPCWSTR szUserSid,
139 __in MSIINSTALLCONTEXT dwContext,
140 __in LPCWSTR szProperty,
141 __out_ecount_opt(*pcchValue) LPWSTR szValue,
142 __inout_opt LPDWORD pcchValue
143 );
144typedef INSTALLSTATE (WINAPI *PFN_MSIQUERYFEATURESTATEW)(
145 __in LPCWSTR szProduct,
146 __in LPCWSTR szFeature
147 );
148typedef UINT (WINAPI *PFN_MSIGETPATCHINFOEXW)(
149 __in_z LPCWSTR wzPatchCode,
150 __in_z LPCWSTR wzProductCode,
151 __in_z_opt LPCWSTR wzUserSid,
152 __in MSIINSTALLCONTEXT dwContext,
153 __in_z LPCWSTR wzProperty,
154 __out_opt LPWSTR wzValue,
155 __inout DWORD* pcchValue
156 );
157typedef UINT (WINAPI *PFN_MSIDETERMINEPATCHSEQUENCEW)(
158 __in_z LPCWSTR wzProductCode,
159 __in_z_opt LPCWSTR wzUserSid,
160 __in MSIINSTALLCONTEXT context,
161 __in DWORD cPatchInfo,
162 __in PMSIPATCHSEQUENCEINFOW pPatchInfo
163 );
164typedef UINT (WINAPI *PFN_MSIDETERMINEAPPLICABLEPATCHESW)(
165 __in_z LPCWSTR wzProductPackagePath,
166 __in DWORD cPatchInfo,
167 __in PMSIPATCHSEQUENCEINFOW pPatchInfo
168 );
169typedef UINT (WINAPI *PFN_MSIINSTALLPRODUCTW)(
170 __in LPCWSTR szPackagePath,
171 __in_opt LPCWSTR szCommandLine
172 );
173typedef UINT (WINAPI *PFN_MSICONFIGUREPRODUCTEXW)(
174 __in LPCWSTR szProduct,
175 __in int iInstallLevel,
176 __in INSTALLSTATE eInstallState,
177 __in_opt LPCWSTR szCommandLine
178 );
179typedef UINT (WINAPI *PFN_MSIREMOVEPATCHESW)(
180 __in_z LPCWSTR wzPatchList,
181 __in_z LPCWSTR wzProductCode,
182 __in INSTALLTYPE eUninstallType,
183 __in_z_opt LPCWSTR szPropertyList
184 );
185typedef INSTALLUILEVEL (WINAPI *PFN_MSISETINTERNALUI)(
186 __in INSTALLUILEVEL dwUILevel,
187 __inout_opt HWND *phWnd
188 );
189typedef UINT (WINAPI *PFN_MSISETEXTERNALUIRECORD)(
190 __in_opt INSTALLUI_HANDLER_RECORD puiHandler,
191 __in DWORD dwMessageFilter,
192 __in_opt LPVOID pvContext,
193 __out_opt PINSTALLUI_HANDLER_RECORD ppuiPrevHandler
194 );
195typedef INSTALLUI_HANDLERW (WINAPI *PFN_MSISETEXTERNALUIW)(
196 __in_opt INSTALLUI_HANDLERW puiHandler,
197 __in DWORD dwMessageFilter,
198 __in_opt LPVOID pvContext
199 );
200typedef UINT (WINAPI *PFN_MSIENUMPRODUCTSW)(
201 __in DWORD iProductIndex,
202 __out_ecount(MAX_GUID_CHARS + 1) LPWSTR lpProductBuf
203 );
204typedef UINT (WINAPI *PFN_MSIENUMPRODUCTSEXW)(
205 __in_z_opt LPCWSTR wzProductCode,
206 __in_z_opt LPCWSTR wzUserSid,
207 __in DWORD dwContext,
208 __in DWORD dwIndex,
209 __out_opt WCHAR wzInstalledProductCode[39],
210 __out_opt MSIINSTALLCONTEXT *pdwInstalledContext,
211 __out_opt LPWSTR wzSid,
212 __inout_opt LPDWORD pcchSid
213 );
214
215typedef UINT (WINAPI *PFN_MSIENUMRELATEDPRODUCTSW)(
216 __in LPCWSTR lpUpgradeCode,
217 __reserved DWORD dwReserved,
218 __in DWORD iProductIndex,
219 __out_ecount(MAX_GUID_CHARS + 1) LPWSTR lpProductBuf
220 );
221typedef UINT (WINAPI *PFN_MSISOURCELISTADDSOURCEEXW)(
222 __in LPCWSTR szProductCodeOrPatchCode,
223 __in_opt LPCWSTR szUserSid,
224 __in MSIINSTALLCONTEXT dwContext,
225 __in DWORD dwOptions,
226 __in LPCWSTR szSource,
227 __in_opt DWORD dwIndex
228 );
229
230
231HRESULT DAPI WiuInitialize(
232 );
233void DAPI WiuUninitialize(
234 );
235void DAPI WiuFunctionOverride(
236 __in_opt PFN_MSIENABLELOGW pfnMsiEnableLogW,
237 __in_opt PFN_MSIGETCOMPONENTPATHW pfnMsiGetComponentPathW,
238 __in_opt PFN_MSILOCATECOMPONENTW pfnMsiLocateComponentW,
239 __in_opt PFN_MSIQUERYFEATURESTATEW pfnMsiQueryFeatureStateW,
240 __in_opt PFN_MSIGETPRODUCTINFOW pfnMsiGetProductInfoW,
241 __in_opt PFN_MSIGETPRODUCTINFOEXW pfnMsiGetProductInfoExW,
242 __in_opt PFN_MSIINSTALLPRODUCTW pfnMsiInstallProductW,
243 __in_opt PFN_MSICONFIGUREPRODUCTEXW pfnMsiConfigureProductExW,
244 __in_opt PFN_MSISETINTERNALUI pfnMsiSetInternalUI,
245 __in_opt PFN_MSISETEXTERNALUIW pfnMsiSetExternalUIW,
246 __in_opt PFN_MSIENUMRELATEDPRODUCTSW pfnMsiEnumRelatedProductsW,
247 __in_opt PFN_MSISETEXTERNALUIRECORD pfnMsiSetExternalUIRecord,
248 __in_opt PFN_MSISOURCELISTADDSOURCEEXW pfnMsiSourceListAddSourceExW
249 );
250HRESULT DAPI WiuGetComponentPath(
251 __in_z LPCWSTR wzProductCode,
252 __in_z LPCWSTR wzComponentId,
253 __out INSTALLSTATE* pInstallState,
254 __out_z LPWSTR* psczValue
255 );
256HRESULT DAPI WiuLocateComponent(
257 __in_z LPCWSTR wzComponentId,
258 __out INSTALLSTATE* pInstallState,
259 __out_z LPWSTR* psczValue
260 );
261HRESULT DAPI WiuQueryFeatureState(
262 __in_z LPCWSTR wzProduct,
263 __in_z LPCWSTR wzFeature,
264 __out INSTALLSTATE* pInstallState
265 );
266HRESULT DAPI WiuGetProductInfo(
267 __in_z LPCWSTR wzProductCode,
268 __in_z LPCWSTR wzProperty,
269 __out LPWSTR* psczValue
270 );
271HRESULT DAPI WiuGetProductInfoEx(
272 __in_z LPCWSTR wzProductCode,
273 __in_z_opt LPCWSTR wzUserSid,
274 __in MSIINSTALLCONTEXT dwContext,
275 __in_z LPCWSTR wzProperty,
276 __out LPWSTR* psczValue
277 );
278HRESULT DAPI WiuGetProductProperty(
279 __in MSIHANDLE hProduct,
280 __in_z LPCWSTR wzProperty,
281 __out LPWSTR* psczValue
282 );
283HRESULT DAPI WiuGetPatchInfoEx(
284 __in_z LPCWSTR wzPatchCode,
285 __in_z LPCWSTR wzProductCode,
286 __in_z_opt LPCWSTR wzUserSid,
287 __in MSIINSTALLCONTEXT dwContext,
288 __in_z LPCWSTR wzProperty,
289 __out LPWSTR* psczValue
290 );
291HRESULT DAPI WiuDeterminePatchSequence(
292 __in_z LPCWSTR wzProductCode,
293 __in_z_opt LPCWSTR wzUserSid,
294 __in MSIINSTALLCONTEXT context,
295 __in PMSIPATCHSEQUENCEINFOW pPatchInfo,
296 __in DWORD cPatchInfo
297 );
298HRESULT DAPI WiuDetermineApplicablePatches(
299 __in_z LPCWSTR wzProductPackagePath,
300 __in PMSIPATCHSEQUENCEINFOW pPatchInfo,
301 __in DWORD cPatchInfo
302 );
303HRESULT DAPI WiuEnumProducts(
304 __in DWORD iProductIndex,
305 __out_ecount(MAX_GUID_CHARS + 1) LPWSTR wzProductCode
306 );
307HRESULT DAPI WiuEnumProductsEx(
308 __in_z_opt LPCWSTR wzProductCode,
309 __in_z_opt LPCWSTR wzUserSid,
310 __in DWORD dwContext,
311 __in DWORD dwIndex,
312 __out_opt WCHAR wzInstalledProductCode[39],
313 __out_opt MSIINSTALLCONTEXT *pdwInstalledContext,
314 __out_opt LPWSTR wzSid,
315 __inout_opt LPDWORD pcchSid
316 );
317HRESULT DAPI WiuEnumRelatedProducts(
318 __in_z LPCWSTR wzUpgradeCode,
319 __in DWORD iProductIndex,
320 __out_ecount(MAX_GUID_CHARS + 1) LPWSTR wzProductCode
321 );
322HRESULT DAPI WiuEnumRelatedProductCodes(
323 __in_z LPCWSTR wzUpgradeCode,
324 __deref_out_ecount_opt(pcRelatedProducts) LPWSTR** prgsczProductCodes,
325 __out DWORD* pcRelatedProducts,
326 __in BOOL fReturnHighestVersionOnly
327 );
328HRESULT DAPI WiuEnableLog(
329 __in DWORD dwLogMode,
330 __in_z LPCWSTR wzLogFile,
331 __in DWORD dwLogAttributes
332 );
333HRESULT DAPI WiuInitializeExternalUI(
334 __in PFN_MSIEXECUTEMESSAGEHANDLER pfnMessageHandler,
335 __in INSTALLUILEVEL internalUILevel,
336 __in HWND hwndParent,
337 __in LPVOID pvContext,
338 __in BOOL fRollback,
339 __in WIU_MSI_EXECUTE_CONTEXT* pExecuteContext
340 );
341void DAPI WiuUninitializeExternalUI(
342 __in WIU_MSI_EXECUTE_CONTEXT* pExecuteContext
343 );
344HRESULT DAPI WiuConfigureProductEx(
345 __in_z LPCWSTR wzProduct,
346 __in int iInstallLevel,
347 __in INSTALLSTATE eInstallState,
348 __in_z LPCWSTR wzCommandLine,
349 __out WIU_RESTART* pRestart
350 );
351HRESULT DAPI WiuInstallProduct(
352 __in_z LPCWSTR wzPackagPath,
353 __in_z LPCWSTR wzCommandLine,
354 __out WIU_RESTART* pRestart
355 );
356HRESULT DAPI WiuRemovePatches(
357 __in_z LPCWSTR wzPatchList,
358 __in_z LPCWSTR wzProductCode,
359 __in_z LPCWSTR wzPropertyList,
360 __out WIU_RESTART* pRestart
361 );
362HRESULT DAPI WiuSourceListAddSourceEx(
363 __in_z LPCWSTR wzProductCodeOrPatchCode,
364 __in_z_opt LPCWSTR wzUserSid,
365 __in MSIINSTALLCONTEXT dwContext,
366 __in DWORD dwCode,
367 __in_z LPCWSTR wzSource,
368 __in_opt DWORD dwIndex
369 );
370
371#ifdef __cplusplus
372}
373#endif
diff --git a/src/dutil/inc/wuautil.h b/src/dutil/inc/wuautil.h
new file mode 100644
index 00000000..b239c4e6
--- /dev/null
+++ b/src/dutil/inc/wuautil.h
@@ -0,0 +1,19 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#if defined(__cplusplus)
6extern "C" {
7#endif
8
9HRESULT DAPI WuaPauseAutomaticUpdates();
10
11HRESULT DAPI WuaResumeAutomaticUpdates();
12
13HRESULT DAPI WuaRestartRequired(
14 __out BOOL* pfRestartRequired
15 );
16
17#if defined(__cplusplus)
18}
19#endif
diff --git a/src/dutil/inc/xmlutil.h b/src/dutil/inc/xmlutil.h
new file mode 100644
index 00000000..3dc119bd
--- /dev/null
+++ b/src/dutil/inc/xmlutil.h
@@ -0,0 +1,167 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5extern __declspec(selectany) const CLSID XmlUtil_CLSID_DOMDocument = {0x2933BF90, 0x7B36, 0x11d2, {0xB2, 0x0E, 0x00, 0xC0, 0x4F, 0x98, 0x3E, 0x60}};
6extern __declspec(selectany) const CLSID XmlUtil_CLSID_DOMDocument20 = {0xF6D90F11, 0x9C73, 0x11D3, {0xB3, 0x2E, 0x00, 0xC0, 0x4F, 0x99, 0x0B, 0xB4}};
7extern __declspec(selectany) const CLSID XmlUtil_CLSID_DOMDocument26 = {0xf5078f1b, 0xc551, 0x11d3, {0x89, 0xb9, 0x00, 0x00, 0xf8, 0x1f, 0xe2, 0x21}};
8extern __declspec(selectany) const CLSID XmlUtil_CLSID_DOMDocument30 = {0xf5078f32, 0xc551, 0x11d3, {0x89, 0xb9, 0x00, 0x00, 0xf8, 0x1f, 0xe2, 0x21}};
9extern __declspec(selectany) const CLSID XmlUtil_CLSID_DOMDocument40 = {0x88d969c0, 0xf192, 0x11d4, {0xa6, 0x5f, 0x00, 0x40, 0x96, 0x32, 0x51, 0xe5}};
10extern __declspec(selectany) const CLSID XmlUtil_CLSID_DOMDocument50 = {0x88d969e5, 0xf192, 0x11d4, {0xa6, 0x5f, 0x00, 0x40, 0x96, 0x32, 0x51, 0xe5}};
11extern __declspec(selectany) const CLSID XmlUtil_CLSID_DOMDocument60 = {0x88d96a05, 0xf192, 0x11d4, {0xa6, 0x5f, 0x00, 0x40, 0x96, 0x32, 0x51, 0xe5}};
12extern __declspec(selectany) const CLSID XmlUtil_CLSID_XMLSchemaCache = {0x88d969c2, 0xf192, 0x11d4, {0xa6, 0x5f, 0x00, 0x40, 0x96, 0x32, 0x51, 0xe5}};
13
14extern __declspec(selectany) const IID XmlUtil_IID_IXMLDOMDocument = {0x2933BF81, 0x7B36, 0x11D2, {0xB2, 0x0E, 0x00, 0xC0, 0x4F, 0x98, 0x3E, 0x60}};
15extern __declspec(selectany) const IID XmlUtil_IID_IXMLDOMDocument2 = {0x2933BF95, 0x7B36, 0x11D2, {0xB2, 0x0E, 0x00, 0xC0, 0x4F, 0x98, 0x3E, 0x60}};
16extern __declspec(selectany) const IID XmlUtil_IID_IXMLDOMSchemaCollection = {0x373984C8, 0xB845, 0x449B, {0x91, 0xE7, 0x45, 0xAC, 0x83, 0x03, 0x6A, 0xDE}};
17
18typedef enum XML_LOAD_ATTRIBUTE
19{
20 XML_LOAD_PRESERVE_WHITESPACE = 1,
21} XML_LOAD_ATTRIBUTE;
22
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28HRESULT DAPI XmlInitialize();
29void DAPI XmlUninitialize();
30
31HRESULT DAPI XmlCreateElement(
32 __in IXMLDOMDocument *pixdDocument,
33 __in_z LPCWSTR wzElementName,
34 __out IXMLDOMElement **ppixnElement
35 );
36HRESULT DAPI XmlCreateDocument(
37 __in_opt LPCWSTR pwzElementName,
38 __out IXMLDOMDocument** ppixdDocument,
39 __out_opt IXMLDOMElement** ppixeRootElement = NULL
40 );
41HRESULT DAPI XmlLoadDocument(
42 __in_z LPCWSTR wzDocument,
43 __out IXMLDOMDocument** ppixdDocument
44 );
45HRESULT DAPI XmlLoadDocumentEx(
46 __in_z LPCWSTR wzDocument,
47 __in DWORD dwAttributes,
48 __out IXMLDOMDocument** ppixdDocument
49 );
50HRESULT DAPI XmlLoadDocumentFromFile(
51 __in_z LPCWSTR wzPath,
52 __out IXMLDOMDocument** ppixdDocument
53 );
54HRESULT DAPI XmlLoadDocumentFromBuffer(
55 __in_bcount(cbSource) const BYTE* pbSource,
56 __in DWORD cbSource,
57 __out IXMLDOMDocument** ppixdDocument
58 );
59HRESULT DAPI XmlLoadDocumentFromFileEx(
60 __in_z LPCWSTR wzPath,
61 __in DWORD dwAttributes,
62 __out IXMLDOMDocument** ppixdDocument
63 );
64HRESULT DAPI XmlSelectSingleNode(
65 __in IXMLDOMNode* pixnParent,
66 __in_z LPCWSTR wzXPath,
67 __out IXMLDOMNode **ppixnChild
68 );
69HRESULT DAPI XmlSetAttribute(
70 __in IXMLDOMNode* pixnNode,
71 __in_z LPCWSTR pwzAttribute,
72 __in_z LPCWSTR pwzAttributeValue
73 );
74HRESULT DAPI XmlCreateTextNode(
75 __in IXMLDOMDocument *pixdDocument,
76 __in_z LPCWSTR wzText,
77 __out IXMLDOMText **ppixnTextNode
78 );
79HRESULT DAPI XmlGetText(
80 __in IXMLDOMNode* pixnNode,
81 __deref_out_z BSTR* pbstrText
82 );
83HRESULT DAPI XmlGetAttribute(
84 __in IXMLDOMNode* pixnNode,
85 __in_z LPCWSTR pwzAttribute,
86 __deref_out_z BSTR* pbstrAttributeValue
87 );
88HRESULT DAPI XmlGetAttributeEx(
89 __in IXMLDOMNode* pixnNode,
90 __in_z LPCWSTR wzAttribute,
91 __deref_out_z LPWSTR* psczAttributeValue
92 );
93HRESULT DAPI XmlGetYesNoAttribute(
94 __in IXMLDOMNode* pixnNode,
95 __in_z LPCWSTR wzAttribute,
96 __out BOOL* pfYes
97 );
98HRESULT DAPI XmlGetAttributeNumber(
99 __in IXMLDOMNode* pixnNode,
100 __in_z LPCWSTR pwzAttribute,
101 __out DWORD* pdwValue
102 );
103HRESULT DAPI XmlGetAttributeNumberBase(
104 __in IXMLDOMNode* pixnNode,
105 __in_z LPCWSTR pwzAttribute,
106 __in int nBase,
107 __out DWORD* pdwValue
108 );
109HRESULT DAPI XmlGetAttributeLargeNumber(
110 __in IXMLDOMNode* pixnNode,
111 __in_z LPCWSTR pwzAttribute,
112 __out DWORD64* pdw64Value
113 );
114HRESULT DAPI XmlGetNamedItem(
115 __in IXMLDOMNamedNodeMap *pixnmAttributes,
116 __in_opt LPCWSTR wzName,
117 __out IXMLDOMNode **ppixnNamedItem
118 );
119HRESULT DAPI XmlSetText(
120 __in IXMLDOMNode* pixnNode,
121 __in_z LPCWSTR pwzText
122 );
123HRESULT DAPI XmlSetTextNumber(
124 __in IXMLDOMNode *pixnNode,
125 __in DWORD dwValue
126 );
127HRESULT DAPI XmlCreateChild(
128 __in IXMLDOMNode* pixnParent,
129 __in_z LPCWSTR pwzElementType,
130 __out IXMLDOMNode** ppixnChild
131 );
132HRESULT DAPI XmlRemoveAttribute(
133 __in IXMLDOMNode* pixnNode,
134 __in_z LPCWSTR pwzAttribute
135 );
136HRESULT DAPI XmlSelectNodes(
137 __in IXMLDOMNode* pixnParent,
138 __in_z LPCWSTR wzXPath,
139 __out IXMLDOMNodeList **ppixnChild
140 );
141HRESULT DAPI XmlNextAttribute(
142 __in IXMLDOMNamedNodeMap* pixnnm,
143 __out IXMLDOMNode** pixnAttribute,
144 __deref_opt_out_z_opt BSTR* pbstrAttribute
145 );
146HRESULT DAPI XmlNextElement(
147 __in IXMLDOMNodeList* pixnl,
148 __out IXMLDOMNode** pixnElement,
149 __deref_opt_out_z_opt BSTR* pbstrElement
150 );
151HRESULT DAPI XmlRemoveChildren(
152 __in IXMLDOMNode* pixnSource,
153 __in_z LPCWSTR pwzXPath
154 );
155HRESULT DAPI XmlSaveDocument(
156 __in IXMLDOMDocument* pixdDocument,
157 __inout LPCWSTR wzPath
158 );
159HRESULT DAPI XmlSaveDocumentToBuffer(
160 __in IXMLDOMDocument* pixdDocument,
161 __deref_out_bcount(*pcbDest) BYTE** ppbDest,
162 __out DWORD* pcbDest
163 );
164
165#ifdef __cplusplus
166}
167#endif