ReactOS 0.4.15-dev-8096-ga0eec98
options.c File Reference
#include <windows.h>
#include "options.h"
Include dependency graph for options.c:

Go to the source code of this file.

Functions

DWORD InitializeConnectionInfo (IN OUT PCONNECTION_INFO Connection, IN PMOUNT_OPTION_BUFFER Options, OUT LPWSTR *ConnectionName)
 
static FORCEINLINE SIZE_T ConnectionBufferSize (IN PCONNECTION_BUFFER Buffer)
 
void MarshalConnectionInfo (IN OUT PCONNECTION_INFO Connection)
 
void FreeConnectionInfo (IN PCONNECTION_INFO Connection)
 

Function Documentation

◆ ConnectionBufferSize()

static FORCEINLINE SIZE_T ConnectionBufferSize ( IN PCONNECTION_BUFFER  Buffer)
static

Definition at line 60 of file options.c.

63{
64 return sizeof(USHORT) + sizeof(USHORT) + sizeof(ULONG) +
65 Buffer->NameLength + Buffer->EaPadding + Buffer->EaLength;
66}
Definition: bufpool.h:45
unsigned short USHORT
Definition: pedump.c:61
uint32_t ULONG
Definition: typedefs.h:59

Referenced by MarshalConnectionInfo().

◆ FreeConnectionInfo()

void FreeConnectionInfo ( IN PCONNECTION_INFO  Connection)

Definition at line 92 of file options.c.

94{
95 if (Connection->Buffer)
96 {
97 LocalFree(Connection->Buffer);
98 Connection->Buffer = NULL;
99 }
100 Connection->Options = NULL;
101 Connection->BufferSize = 0;
102}
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594

Referenced by NPAddConnection3().

◆ InitializeConnectionInfo()

DWORD InitializeConnectionInfo ( IN OUT PCONNECTION_INFO  Connection,
IN PMOUNT_OPTION_BUFFER  Options,
OUT LPWSTR ConnectionName 
)

Definition at line 26 of file options.c.

30{
33
34 /* verify that this is a mount options buffer */
35 if (Options &&
36 Options->Zero == 0 &&
38 {
39 Connection->Options = Options;
41 }
42 else
43 {
44 Connection->Options = NULL;
46 }
47
48 Connection->Buffer = LocalAlloc(LMEM_ZEROINIT, size);
49 if (Connection->Buffer)
50 *ConnectionName = (LPWSTR)Connection->Buffer->Buffer;
51 else
53
54 return result;
55}
#define MAX_CONNECTION_BUFFER_SIZE(EaSize)
Definition: options.h:61
#define MOUNT_OPTION_BUFFER_SECRET
Definition: options.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLuint64EXT * result
Definition: glext.h:11304
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
ULONG_PTR SIZE_T
Definition: typedefs.h:80
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3534
#define LMEM_ZEROINIT
Definition: winbase.h:375
#define WN_OUT_OF_MEMORY
Definition: winnetwk.h:125
#define WN_SUCCESS
Definition: winnetwk.h:111
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by NPAddConnection3().

◆ MarshalConnectionInfo()

void MarshalConnectionInfo ( IN OUT PCONNECTION_INFO  Connection)

Definition at line 68 of file options.c.

70{
71 PCONNECTION_BUFFER Buffer = Connection->Buffer;
72 LPWSTR ConnectionName = (LPWSTR)Buffer->Buffer;
73
74 Buffer->NameLength = (USHORT)(wcslen(ConnectionName) + 1) * sizeof(WCHAR);
75
76 /* copy the EaBuffer after the end of ConnectionName */
77 if (Connection->Options && Connection->Options->Length)
78 {
79 PBYTE ptr = Buffer->Buffer + Buffer->NameLength;
80 /* add padding so EaBuffer starts on a ULONG boundary */
81 Buffer->EaPadding = (USHORT)
82 (sizeof(ULONG) - (SIZE_T)ptr % sizeof(ULONG)) % sizeof(ULONG);
83 Buffer->EaLength = Connection->Options->Length;
84 ptr += Buffer->EaPadding;
85
86 RtlCopyMemory(ptr, Connection->Options->Buffer, Buffer->EaLength);
87 }
88
89 Connection->BufferSize = (ULONG)ConnectionBufferSize(Buffer);
90}
static FORCEINLINE SIZE_T ConnectionBufferSize(IN PCONNECTION_BUFFER Buffer)
Definition: options.c:60
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static PVOID ptr
Definition: dispmode.c:27
BYTE * PBYTE
Definition: pedump.c:66
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by NPAddConnection3().