#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <conutils.h>
#include "resource.h"
Go to the source code of this file.
◆ AddSubst()
Definition at line 215 of file subst.c.
216{
217 DWORD dwResult, dwPathAttr;
218
220 {
222 goto Quit;
223 }
224
225
226
227
228
229
230
234 {
236 goto Quit;
237 }
238
239
240
241
242
243
244
247 goto Quit;
248
251 else
253
254Quit:
255 switch (dwResult)
256 {
258 break;
259
262 {
264 return 1;
265 }
266
268 {
270 return 1;
271 }
272
275 {
277 return 1;
278 }
279
281 {
283 return 1;
284 }
285
286 default:
287 {
289 return 1;
290 }
291 }
292
293 return 0;
294}
PRTL_UNICODE_STRING_BUFFER Path
#define IDS_PATH_NOT_FOUND
#define IDS_INVALID_PARAMETER2
#define IDS_DRIVE_ALREADY_SUBSTED
#define IDS_ACCESS_DENIED
void ConResPrintf(FILE *fp, UINT nID,...)
void ConResPuts(FILE *fp, UINT nID)
#define ERROR_INVALID_PARAMETER
#define ERROR_ACCESS_DENIED
BOOL WINAPI DefineDosDeviceW(DWORD dwFlags, LPCWSTR lpDeviceName, LPCWSTR lpTargetPath)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
#define ERROR_FILE_NOT_FOUND
#define FILE_ATTRIBUTE_DIRECTORY
ULONG QuerySubstedDrive(IN WCHAR DriveLetter, IN OUT PWSTR *TargetPath OPTIONAL, IN OUT PULONG Size)
VOID PrintError(IN DWORD ErrCode)
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
#define ERROR_PATH_NOT_FOUND
#define ERROR_INVALID_DRIVE
Referenced by wmain().
◆ DeleteSubst()
Definition at line 165 of file subst.c.
166{
168
170 {
172 goto Quit;
173 }
174
176 {
178 goto Quit;
179 }
180
183 else
185
186Quit:
187 switch (dwResult)
188 {
190 break;
191
192
194 {
196 return 1;
197 }
198
200 {
202 return 1;
203 }
204
205 default:
206 {
208 return 1;
209 }
210 }
211
212 return 0;
213}
#define DDD_REMOVE_DEFINITION
Referenced by wmain().
◆ DumpSubstedDrives()
Definition at line 139 of file subst.c.
140{
145
148 if (!lpTargetPath)
149 return;
150
152 {
153 DriveLetter =
L'A' +
i;
155 {
157 }
158
160 }
161
163}
void ConPrintf(FILE *fp, LPCWSTR psz,...)
#define HeapFree(x, y, z)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Referenced by wmain().
◆ PrintError()
Definition at line 24 of file subst.c.
25{
26
28
29#if 0
31 return;
32#endif
33
34
35
39 ErrCode,
43 if (pMsgBuf )
44 {
46 ErrCode, pMsgBuf);
48 }
49}
#define IDS_FAILED_WITH_ERRORCODE
HLOCAL NTAPI LocalFree(HLOCAL hMem)
#define LANG_USER_DEFAULT
#define FORMAT_MESSAGE_MAX_WIDTH_MASK
#define FORMAT_MESSAGE_IGNORE_INSERTS
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Referenced by AddSubst(), and DeleteSubst().
◆ QuerySubstedDrive()
Definition at line 51 of file subst.c.
54{
59
60 Drive[0] = DriveLetter;
61
62
63 if (!TargetPath)
64 {
65
68 if (!lpTargetPath)
70 }
71 else
72 {
73
76
77 lpTargetPath = *TargetPath;
79 }
80
82
84 if (!CharCount)
86
88 {
89
92 if (!tmp)
93 {
94
95 CharCount = 0;
97 }
98 else
99 {
100
101 lpTargetPath = tmp;
103 }
104 }
105
106 if (CharCount)
107 {
108 if (
wcsncmp(lpTargetPath,
L"\\??\\", 4) == 0 &&
109 ( (lpTargetPath[4] >=
L'A' && lpTargetPath[4] <=
L'Z') ||
110 (lpTargetPath[4] >=
L'a' && lpTargetPath[4] <=
L'z') ) )
111 {
112
114 }
115#if 0
116 else
117 {
118
120 }
121#endif
122 }
123
124 if (!TargetPath)
125 {
126
128 }
129 else
130 {
131
132 *TargetPath = lpTargetPath;
134 }
135
137}
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
#define ERROR_NOT_ENOUGH_MEMORY
#define ERROR_INSUFFICIENT_BUFFER
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
_ACRTIMP int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Referenced by AddSubst(), DeleteSubst(), and DumpSubstedDrives().
◆ wmain()
Definition at line 296 of file subst.c.
297{
299
300
302
304 {
306 {
308 return 0;
309 }
310 }
311
313 {
315 {
317 return 1;
318 }
320 return 0;
321 }
322
324 {
326 return 1;
327 }
328
334}
#define IDS_INCORRECT_PARAMETER_COUNT
#define IDS_INVALID_PARAMETER
#define ConInitStdStreams()
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
VOID DumpSubstedDrives(VOID)
INT DeleteSubst(IN PWSTR Drive)
INT AddSubst(IN PWSTR Drive, IN PWSTR Path)