ReactOS 0.4.15-dev-7998-gdb93cb1
firmware.c File Reference
#include <ndk/exfuncs.h>
#include "k32_vista.h"
Include dependency graph for firmware.c:

Go to the source code of this file.

Macros

#define NTDDI_VERSION   NTDDI_VISTA
 

Functions

 _Success_ (return, 0)
 
BOOL WINAPI SetFirmwareEnvironmentVariableExW (_In_ LPCWSTR lpName, _In_ LPCWSTR lpGuid, _In_reads_bytes_opt_(nSize) PVOID pValue, _In_ DWORD nSize, _In_ DWORD dwAttributes)
 
BOOL WINAPI SetFirmwareEnvironmentVariableExA (_In_ LPCSTR lpName, _In_ LPCSTR lpGuid, _In_reads_bytes_opt_(nSize) PVOID pValue, _In_ DWORD nSize, _In_ DWORD dwAttributes)
 
 _Success_ (return)
 

Macro Definition Documentation

◆ NTDDI_VERSION

#define NTDDI_VERSION   NTDDI_VISTA

Definition at line 10 of file firmware.c.

Function Documentation

◆ _Success_() [1/2]

_Success_ ( return  = = 0)

Definition at line 203 of file firmware.c.

207{
210
211 /* Check input parameters */
212 if (FirmwareType == NULL)
213 {
215 return FALSE;
216 }
217
218 /* Query firmware type */
220 &BootInfo,
221 sizeof(BootInfo),
222 0);
223 if (!NT_SUCCESS(Status))
224 {
226 return FALSE;
227 }
228
229 *FirmwareType = BootInfo.FirmwareType;
230 return TRUE;
231}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
Status
Definition: gdiplustypes.h:25
@ SystemBootEnvironmentInformation
Definition: extypes.h:307
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)

◆ _Success_() [2/2]

_Success_ ( return  ,
 
)

Definition at line 15 of file firmware.c.

24{
26 UNICODE_STRING VariableName, Namespace;
27 GUID VendorGuid;
29
30 /* Check input parameters and build NT strings */
31 if (!lpName || !lpGuid)
32 {
34 return 0;
35 }
36 RtlInitUnicodeString(&VariableName, lpName);
37 RtlInitUnicodeString(&Namespace, lpGuid);
38 Status = RtlGUIDFromString(&Namespace, &VendorGuid);
39 if (!NT_SUCCESS(Status))
40 {
42 return 0;
43 }
44
45 /* Query firmware system environment variable value */
46 Length = nSize;
48 &VendorGuid,
49 pBuffer,
50 &Length,
51 pdwAttribubutes);
52 if (!NT_SUCCESS(Status))
53 {
55 return 0;
56 }
57
58 return Length;
59}
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTATUS NTAPI NtQuerySystemEnvironmentValueEx(_In_ PUNICODE_STRING VariableName, _In_ LPGUID VendorGuid, _Out_opt_ PVOID Value, _Inout_ PULONG ReturnLength, _Out_opt_ PULONG Attributes)
Definition: sysinfo.c:567
PVOID pBuffer
uint32_t ULONG
Definition: typedefs.h:59
_In_ LPCSTR lpName
Definition: winbase.h:2789
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2084

◆ SetFirmwareEnvironmentVariableExA()

BOOL WINAPI SetFirmwareEnvironmentVariableExA ( _In_ LPCSTR  lpName,
_In_ LPCSTR  lpGuid,
_In_reads_bytes_opt_(nSize) PVOID  pValue,
_In_ DWORD  nSize,
_In_ DWORD  dwAttributes 
)

Definition at line 156 of file firmware.c.

162{
164 BOOL Result;
165 UNICODE_STRING VariableName, Namespace;
166 ANSI_STRING AnsiVariableName, AnsiNamespace;
167
168 /* Check input parameters and build NT strings */
169 if (!lpName || !lpGuid)
170 {
172 return FALSE;
173 }
174 RtlInitString(&AnsiVariableName, lpName);
175 Status = RtlAnsiStringToUnicodeString(&VariableName, &AnsiVariableName, TRUE);
176 if (!NT_SUCCESS(Status))
177 {
179 return FALSE;
180 }
181 RtlInitString(&AnsiNamespace, lpGuid);
182 Status = RtlAnsiStringToUnicodeString(&Namespace, &AnsiNamespace, TRUE);
183 if (!NT_SUCCESS(Status))
184 {
185 RtlFreeUnicodeString(&VariableName);
187 return FALSE;
188 }
189
190 /* Call unicode version interface */
192 Namespace.Buffer,
193 pValue,
194 nSize,
196
197 /* Cleanup and return */
198 RtlFreeUnicodeString(&Namespace);
199 RtlFreeUnicodeString(&VariableName);
200 return Result;
201}
BOOL WINAPI SetFirmwareEnvironmentVariableExW(_In_ LPCWSTR lpName, _In_ LPCWSTR lpGuid, _In_reads_bytes_opt_(nSize) PVOID pValue, _In_ DWORD nSize, _In_ DWORD dwAttributes)
Definition: firmware.c:113
unsigned int BOOL
Definition: ntddk_ex.h:94
PWCHAR pValue
NTSYSAPI VOID NTAPI RtlInitString(PSTRING DestinationString, PCSZ SourceString)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
DWORD dwAttributes
Definition: vdmdbg.h:34
_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
Definition: wsk.h:409

Referenced by SetFirmwareEnvironmentVariableA().

◆ SetFirmwareEnvironmentVariableExW()

BOOL WINAPI SetFirmwareEnvironmentVariableExW ( _In_ LPCWSTR  lpName,
_In_ LPCWSTR  lpGuid,
_In_reads_bytes_opt_(nSize) PVOID  pValue,
_In_ DWORD  nSize,
_In_ DWORD  dwAttributes 
)

Definition at line 113 of file firmware.c.

119{
121 UNICODE_STRING VariableName, Namespace;
122 GUID VendorGuid;
123
124 /* Check input parameters and build NT strings */
125 if (!lpName || !lpGuid)
126 {
128 return FALSE;
129 }
130 RtlInitUnicodeString(&VariableName, lpName);
131 RtlInitUnicodeString(&Namespace, lpGuid);
132 Status = RtlGUIDFromString(&Namespace, &VendorGuid);
133 if (!NT_SUCCESS(Status))
134 {
136 return FALSE;
137 }
138
139 /* Set firmware system environment variable value */
141 &VendorGuid,
142 pValue,
143 nSize,
145 if (!NT_SUCCESS(Status))
146 {
148 return FALSE;
149 }
150
151 return TRUE;
152}
NTSTATUS NTAPI NtSetSystemEnvironmentValueEx(_In_ PUNICODE_STRING VariableName, _In_ LPGUID VendorGuid, _In_reads_bytes_opt_(ValueLength) PVOID Value, _In_ ULONG ValueLength, _In_ ULONG Attributes)
Definition: sysinfo.c:580

Referenced by SetFirmwareEnvironmentVariableExA(), and SetFirmwareEnvironmentVariableW().