ReactOS 0.4.15-dev-7907-g95bf896
uniqueid.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS DiskPart
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/system/diskpart/uniqueid.c
5 * PURPOSE: Manages all the partitions of the OS in an interactive way.
6 * PROGRAMMERS: Lee Schroeder
7 */
8
9#include "diskpart.h"
10
11#define NDEBUG
12#include <debug.h>
13
14/* FUNCTIONS ******************************************************************/
15
16BOOL
20{
21 PWSTR pszSuffix = NULL;
22 ULONG ulValue;
23
24 if (CurrentDisk == NULL)
25 {
27 return TRUE;
28 }
29
30 if (argc == 2)
31 {
32 ConPuts(StdOut, L"\n");
33 ConPrintf(StdOut, L"Disk ID: %08lx\n", CurrentDisk->LayoutBuffer->Signature);
34 ConPuts(StdOut, L"\n");
35 return TRUE;
36 }
37
38 if (argc != 3)
39 {
41 return TRUE;
42 }
43
44 if (!HasPrefix(argv[2], L"ID=", &pszSuffix))
45 {
47 return TRUE;
48 }
49
50 if ((pszSuffix == NULL) ||
51 (wcslen(pszSuffix) != 8) ||
52 (IsHexString(pszSuffix) == FALSE))
53 {
55 return TRUE;
56 }
57
58 ulValue = wcstoul(pszSuffix, NULL, 16);
59 if ((ulValue == 0) && (errno == ERANGE))
60 {
62 return TRUE;
63 }
64
65 DPRINT("New Signature: 0x%08lx\n", ulValue);
70
71 return TRUE;
72}
static int argc
Definition: ServiceArgs.c:12
#define ERANGE
Definition: acclib.h:92
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
void ConPrintf(FILE *fp, LPCWSTR psz,...)
Definition: fc.c:20
#define StdOut
Definition: fc.c:14
#define StdErr
Definition: fc.c:15
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:187
#define IDS_SELECT_NO_DISK
Definition: resource.h:85
BOOL UniqueIdDisk(_In_ INT argc, _In_ PWSTR *argv)
Definition: uniqueid.c:17
BOOL HasPrefix(_In_ PWSTR pszString, _In_ PWSTR pszPrefix, _Out_opt_ PWSTR *pszSuffix)
Definition: misc.c:58
PDISKENTRY CurrentDisk
Definition: partlist.c:74
BOOL IsHexString(_In_ PWSTR pszHexString)
Definition: misc.c:36
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define argv
Definition: mplay32.c:18
#define _In_
Definition: ms_sal.h:308
#define L(x)
Definition: ntvdm.h:50
#define errno
Definition: errno.h:18
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2541
NTSTATUS WritePartitions(IN PDISKENTRY DiskEntry)
Definition: partlist.c:3663
#define DPRINT
Definition: sndvol32.h:71
BOOLEAN Dirty
Definition: partlist.h:115
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:122
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59