#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <conutils.h>
#include "resource.h"
Go to the source code of this file.
◆ WIN32_NO_STATUS
◆ AddSubst()
Definition at line 216 of file subst.c.
217{
218 DWORD dwResult, dwPathAttr;
219
221 {
223 goto Quit;
224 }
225
226
227
228
229
230
231
235 {
237 goto Quit;
238 }
239
240
241
242
243
244
245
248 goto Quit;
249
252 else
254
255Quit:
256 switch (dwResult)
257 {
259 break;
260
263 {
265 return 1;
266 }
267
269 {
271 return 1;
272 }
273
276 {
278 return 1;
279 }
280
282 {
284 return 1;
285 }
286
287 default:
288 {
290 return 1;
291 }
292 }
293
294 return 0;
295}
PRTL_UNICODE_STRING_BUFFER Path
void ConResPrintf(FILE *fp, UINT nID,...)
void ConResPuts(FILE *fp, UINT nID)
#define IDS_PATH_NOT_FOUND
#define IDS_INVALID_PARAMETER2
#define IDS_DRIVE_ALREADY_SUBSTED
#define IDS_ACCESS_DENIED
#define ERROR_INVALID_PARAMETER
#define ERROR_ACCESS_DENIED
BOOL WINAPI DefineDosDeviceW(DWORD dwFlags, LPCWSTR lpDeviceName, LPCWSTR lpTargetPath)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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 166 of file subst.c.
167{
169
171 {
173 goto Quit;
174 }
175
177 {
179 goto Quit;
180 }
181
184 else
186
187Quit:
188 switch (dwResult)
189 {
191 break;
192
193
195 {
197 return 1;
198 }
199
201 {
203 return 1;
204 }
205
206 default:
207 {
209 return 1;
210 }
211 }
212
213 return 0;
214}
#define DDD_REMOVE_DEFINITION
Referenced by wmain().
◆ DumpSubstedDrives()
Definition at line 140 of file subst.c.
141{
146
149 if (!lpTargetPath)
150 return;
151
153 {
154 DriveLetter =
L'A' +
i;
156 {
158 }
159
161 }
162
164}
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 25 of file subst.c.
26{
27
29
30#if 0
32 return;
33#endif
34
35
36
40 ErrCode,
44 if (pMsgBuf )
45 {
47 ErrCode, pMsgBuf);
49 }
50}
#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 52 of file subst.c.
55{
60
61 Drive[0] = DriveLetter;
62
63
64 if (!TargetPath)
65 {
66
69 if (!lpTargetPath)
71 }
72 else
73 {
74
77
78 lpTargetPath = *TargetPath;
80 }
81
83
85 if (!CharCount)
87
89 {
90
93 if (!tmp)
94 {
95
96 CharCount = 0;
98 }
99 else
100 {
101
102 lpTargetPath = tmp;
104 }
105 }
106
107 if (CharCount)
108 {
109 if (
wcsncmp(lpTargetPath,
L"\\??\\", 4) == 0 &&
110 ( (lpTargetPath[4] >=
L'A' && lpTargetPath[4] <=
L'Z') ||
111 (lpTargetPath[4] >=
L'a' && lpTargetPath[4] <=
L'z') ) )
112 {
113
115 }
116#if 0
117 else
118 {
119
121 }
122#endif
123 }
124
125 if (!TargetPath)
126 {
127
129 }
130 else
131 {
132
133 *TargetPath = lpTargetPath;
135 }
136
138}
_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)
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
_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 297 of file subst.c.
298{
300
301
303
305 {
307 {
309 return 0;
310 }
311 }
312
314 {
316 {
318 return 1;
319 }
321 return 0;
322 }
323
325 {
327 return 1;
328 }
329
335}
#define ConInitStdStreams()
#define IDS_INCORRECT_PARAMETER_COUNT
#define IDS_INVALID_PARAMETER
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
VOID DumpSubstedDrives(VOID)
INT DeleteSubst(IN PWSTR Drive)
INT AddSubst(IN PWSTR Drive, IN PWSTR Path)