mirror of
https://github.com/reactos/reactos.git
synced 2025-05-30 14:39:46 +00:00
[NET]
On dismount, you can either use: net use /delete <drive>: or net use <drive>: /delete CORE-13517 svn path=/trunk/; revision=75271
This commit is contained in:
parent
c8ee4f6694
commit
3ff085924b
1 changed files with 43 additions and 25 deletions
|
@ -78,12 +78,32 @@ PrintError(DWORD Status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
BOOL
|
||||||
|
ValidateDeviceName(PWSTR DevName)
|
||||||
|
{
|
||||||
|
DWORD Len;
|
||||||
|
|
||||||
|
Len = wcslen(DevName);
|
||||||
|
if (Len != 2)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!iswalpha(DevName[0]) || DevName[1] != L':')
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
INT
|
INT
|
||||||
cmdUse(
|
cmdUse(
|
||||||
INT argc,
|
INT argc,
|
||||||
WCHAR **argv)
|
WCHAR **argv)
|
||||||
{
|
{
|
||||||
DWORD Status, Len;
|
DWORD Status, Len, Delete;
|
||||||
|
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
|
@ -97,14 +117,7 @@ cmdUse(
|
||||||
}
|
}
|
||||||
else if (argc == 3)
|
else if (argc == 3)
|
||||||
{
|
{
|
||||||
Len = wcslen(argv[2]);
|
if (!ValidateDeviceName(argv[2]))
|
||||||
if (Len != 2)
|
|
||||||
{
|
|
||||||
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!iswalpha(argv[2][0]) || argv[2][1] != L':')
|
|
||||||
{
|
{
|
||||||
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -119,34 +132,39 @@ cmdUse(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Len = wcslen(argv[2]);
|
Delete = 0;
|
||||||
if (Len != 1 && Len != 2)
|
if (wcsicmp(argv[2], L"/DELETE") == 0)
|
||||||
|
{
|
||||||
|
Delete = 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((argv[2][0] != '*' && argv[2][1] != 0) &&
|
||||||
|
!ValidateDeviceName(argv[2]))
|
||||||
{
|
{
|
||||||
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Len == 2 && argv[2][1] != L':')
|
|
||||||
{
|
|
||||||
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argv[2][0] != L'*' && !iswalpha(argv[2][0]))
|
|
||||||
{
|
|
||||||
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wcsicmp(argv[3], L"/DELETE") == 0)
|
if (wcsicmp(argv[3], L"/DELETE") == 0)
|
||||||
{
|
{
|
||||||
if (argv[2][0] == L'*')
|
Delete = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Delete != 0)
|
||||||
|
{
|
||||||
|
if (!ValidateDeviceName(argv[Delete]) || argv[Delete][0] == L'*')
|
||||||
{
|
{
|
||||||
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return WNetCancelConnection2(argv[2], CONNECT_UPDATE_PROFILE, FALSE);
|
Status = WNetCancelConnection2(argv[Delete], CONNECT_UPDATE_PROFILE, FALSE);
|
||||||
|
if (Status != NO_ERROR)
|
||||||
|
PrintError(Status);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue