2011-09-24 10:33:33 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS DiskPart
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: base/system/diskpart/uniqueid.c
|
2016-10-01 22:58:21 +00:00
|
|
|
* PURPOSE: Manages all the partitions of the OS in an interactive way.
|
2011-09-24 10:33:33 +00:00
|
|
|
* PROGRAMMERS: Lee Schroeder
|
|
|
|
*/
|
2014-01-13 13:07:50 +00:00
|
|
|
|
2011-09-24 10:33:33 +00:00
|
|
|
#include "diskpart.h"
|
|
|
|
|
2022-03-27 15:54:38 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
UniqueIdDisk(
|
|
|
|
_In_ INT argc,
|
|
|
|
_In_ LPWSTR *argv)
|
|
|
|
{
|
2022-03-27 22:04:24 +00:00
|
|
|
ULONG ulLength, ulValue;
|
2022-03-27 15:54:38 +00:00
|
|
|
|
|
|
|
if (CurrentDisk == NULL)
|
|
|
|
{
|
|
|
|
ConResPuts(StdOut, IDS_SELECT_NO_DISK);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
|
|
|
ConPuts(StdOut, L"\n");
|
|
|
|
ConPrintf(StdOut, L"Disk ID: %08lx\n", CurrentDisk->LayoutBuffer->Signature);
|
|
|
|
ConPuts(StdOut, L"\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argc != 3)
|
|
|
|
{
|
2022-03-27 22:04:24 +00:00
|
|
|
ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
|
2022-03-27 15:54:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ulLength = wcslen(argv[2]);
|
|
|
|
if ((ulLength <= 3) || (ulLength > 11))
|
|
|
|
{
|
2022-03-27 22:04:24 +00:00
|
|
|
ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
|
2022-03-27 15:54:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-27 18:09:34 +00:00
|
|
|
if (!HasPrefix(argv[2], L"ID="))
|
2022-03-27 15:54:38 +00:00
|
|
|
{
|
2022-03-27 22:04:24 +00:00
|
|
|
ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
|
2022-03-27 15:54:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-27 22:04:24 +00:00
|
|
|
if (!IsHexString(&argv[2][3]))
|
2022-03-27 15:54:38 +00:00
|
|
|
{
|
2022-03-27 22:04:24 +00:00
|
|
|
ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
|
2022-03-27 15:54:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-27 22:04:24 +00:00
|
|
|
ulValue = wcstoul(&argv[2][3], NULL, 16);
|
2022-03-27 15:54:38 +00:00
|
|
|
if ((ulValue == 0) && (errno == ERANGE))
|
|
|
|
{
|
|
|
|
ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConPrintf(StdOut, L"Setting the disk signature is not implemented yet!\n");
|
|
|
|
#if 0
|
|
|
|
DPRINT1("New Signature: %lx\n", ulValue);
|
|
|
|
CurrentDisk->LayoutBuffer->Signature = ulValue;
|
|
|
|
// SetDiskLayout(CurrentDisk);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL uniqueid_main(INT argc, LPWSTR *argv)
|
2011-09-24 10:33:33 +00:00
|
|
|
{
|
2022-03-27 15:54:38 +00:00
|
|
|
/* gets the first word from the string */
|
|
|
|
if (argc == 1)
|
|
|
|
{
|
|
|
|
ConResPuts(StdOut, IDS_HELP_CMD_UNIQUEID);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* determines which details to print (disk, partition, etc.) */
|
|
|
|
if (!wcsicmp(argv[1], L"disk"))
|
|
|
|
UniqueIdDisk(argc, argv);
|
|
|
|
else
|
|
|
|
ConResPuts(StdOut, IDS_HELP_CMD_UNIQUEID);
|
|
|
|
|
2011-09-24 10:33:33 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|