#include "precomp.h"
#include <winuser.h>
#include <winnls.h>
#include <wchar.h>
#include <sal.h>
#include "mswhelper.h"
Go to the source code of this file.
|
void | mswBufferInit (_Inout_ PMSW_BUFFER mswBuf, _In_ BYTE *buffer, _In_ DWORD bufferSize) |
|
BOOL | mswBufferCheck (_Inout_ PMSW_BUFFER mswBuf, _In_ DWORD count) |
|
BOOL | mswBufferIncUsed (_Inout_ PMSW_BUFFER mswBuf, _In_ DWORD count) |
|
BYTE * | mswBufferEndPtr (_Inout_ PMSW_BUFFER mswBuf) |
|
BOOL | mswBufferAppend (_Inout_ PMSW_BUFFER mswBuf, _In_ void *dataToAppend, _In_ DWORD dataSize) |
|
BOOL | mswBufferAppendStrA (_Inout_ PMSW_BUFFER mswBuf, _In_ char *str) |
|
BOOL | mswBufferAppendStrW (_Inout_ PMSW_BUFFER mswBuf, _In_ WCHAR *str) |
|
BOOL | mswBufferAppendPtr (_Inout_ PMSW_BUFFER mswBuf, _In_ void *ptr) |
|
BOOL | mswBufferAppendLst (_Inout_ PMSW_BUFFER mswBuf, _In_ void **lst, _In_ DWORD itemByteLength, _In_opt_ int ptrofs) |
|
BOOL | mswBufferAppendStrLstA (_Inout_ PMSW_BUFFER mswBuf, _In_ void **lst, _In_opt_ int ptrofs) |
|
BOOL | mswBufferAppendBlob_Hostent (_Inout_ PMSW_BUFFER mswBuf, _Inout_ LPWSAQUERYSETW lpRes, _In_ char **hostAliasesA, _In_ char *hostnameA, _In_ DWORD ip4addr) |
|
BOOL | mswBufferAppendBlob_Servent (_Inout_ PMSW_BUFFER mswBuf, _Inout_ LPWSAQUERYSETW lpRes, _In_ char *serviceNameA, _In_ char **serviceAliasesA, _In_ char *protocolNameA, _In_ WORD port) |
|
BOOL | mswBufferAppendAddr_AddrInfoW (_Inout_ PMSW_BUFFER mswBuf, _Inout_ LPWSAQUERYSETW lpRes, _In_ DWORD ip4addr) |
|
WCHAR * | StrA2WHeapAlloc (_In_opt_ HANDLE hHeap, _In_ char *aStr) |
|
char * | StrW2AHeapAlloc (_In_opt_ HANDLE hHeap, _In_ WCHAR *wStr) |
|
WCHAR * | StrCpyHeapAllocW (_In_opt_ HANDLE hHeap, _In_ WCHAR *wStr) |
|
char * | StrCpyHeapAllocA (_In_opt_ HANDLE hHeap, _In_ char *aStr) |
|
char ** | StrAryCpyHeapAllocA (_In_opt_ HANDLE hHeap, _In_ char **aStrAry) |
|
char ** | StrAryCpyHeapAllocWToA (_In_opt_ HANDLE hHeap, _In_ WCHAR **wStrAry) |
|
◆ MAX_ARRAY_SIZE
◆ MSW_BUFSIZE
◆ mswBufferAppend()
◆ mswBufferAppendAddr_AddrInfoW()
Definition at line 352 of file mswhelper.c.
359 lpRes->dwNumberOfCsAddrs = 1;
362 paddrinfo = lpRes->lpcsaBuffer;
384 psa->sin_addr.s_addr = 0;
391 psa->sin_addr.s_addr = ip4addr;
struct sockaddr_in * LPSOCKADDR_IN
BYTE * mswBufferEndPtr(_Inout_ PMSW_BUFFER mswBuf)
SOCKET_ADDRESS RemoteAddr
struct _CSADDR_INFO * LPCSADDR_INFO
BOOL mswBufferIncUsed(_Inout_ PMSW_BUFFER mswBuf, _In_ DWORD count)
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
#define RtlZeroMemory(Destination, Length)
struct sockaddr * LPSOCKADDR
Referenced by NSP_LookupServiceNextW().
◆ mswBufferAppendBlob_Hostent()
Definition at line 227 of file mswhelper.c.
244 lpRes->lpBlob->cbSize = 0;
248 phe = (
PHOSTENT)lpRes->lpBlob->pBlobData;
263 (
void**)hostAliasesA,
276 lst[0] = (
void*)&ip4addr;
290 return mswBuf->bufok;
BOOL mswBufferAppendPtr(_Inout_ PMSW_BUFFER mswBuf, _In_ void *ptr)
BOOL mswBufferAppendStrA(_Inout_ PMSW_BUFFER mswBuf, _In_ char *str)
BYTE * mswBufferEndPtr(_Inout_ PMSW_BUFFER mswBuf)
BOOL mswBufferAppendLst(_Inout_ PMSW_BUFFER mswBuf, _In_ void **lst, _In_ DWORD itemByteLength, _In_opt_ int ptrofs)
BOOL mswBufferIncUsed(_Inout_ PMSW_BUFFER mswBuf, _In_ DWORD count)
#define RtlZeroMemory(Destination, Length)
BOOL mswBufferAppendStrLstA(_Inout_ PMSW_BUFFER mswBuf, _In_ void **lst, _In_opt_ int ptrofs)
struct hostent * PHOSTENT
Referenced by NSP_LookupServiceNextW().
◆ mswBufferAppendBlob_Servent()
Definition at line 294 of file mswhelper.c.
310 lpRes->lpBlob->cbSize = 0;
314 pse = (
LPSERVENT)lpRes->lpBlob->pBlobData;
325 (
void**)serviceAliasesA,
348 return mswBuf->bufok;
BOOL mswBufferAppendPtr(_Inout_ PMSW_BUFFER mswBuf, _In_ void *ptr)
struct servent * LPSERVENT
BOOL mswBufferAppendStrA(_Inout_ PMSW_BUFFER mswBuf, _In_ char *str)
BYTE * mswBufferEndPtr(_Inout_ PMSW_BUFFER mswBuf)
BOOL mswBufferIncUsed(_Inout_ PMSW_BUFFER mswBuf, _In_ DWORD count)
BOOL mswBufferAppendStrLstA(_Inout_ PMSW_BUFFER mswBuf, _In_ void **lst, _In_opt_ int ptrofs)
Referenced by NSP_LookupServiceNextW().
◆ mswBufferAppendLst()
Definition at line 104 of file mswhelper.c.
124 lstByteSize = ((lstItemCount + 1) *
sizeof(
UINT_PTR)) +
125 (lstItemCount * itemByteLength);
127 if (mswBuf->bytesUsed + lstByteSize > mswBuf->bytesMax)
131 lstDataPos = ((lstItemCount + 1) *
sizeof(
UINT_PTR)) +
134 lstDataPos += ptrofs;
137 for (i1 = 0; i1 < lstItemCount; i1++)
151 for (i1 = 0; i1 < lstItemCount; i1++)
156 return mswBuf->bufok;
unsigned __int3264 UINT_PTR
BOOL mswBufferAppendPtr(_Inout_ PMSW_BUFFER mswBuf, _In_ void *ptr)
BYTE * mswBufferEndPtr(_Inout_ PMSW_BUFFER mswBuf)
unsigned __int3264 UINT_PTR
BOOL mswBufferAppend(_Inout_ PMSW_BUFFER mswBuf, _In_ void *dataToAppend, _In_ DWORD dataSize)
Referenced by mswBufferAppendBlob_Hostent().
◆ mswBufferAppendPtr()
◆ mswBufferAppendStrA()
◆ mswBufferAppendStrLstA()
Definition at line 160 of file mswhelper.c.
182 i1 =
strlen((
char*)*ptrSrcLstPos) +
sizeof(
char);
183 lstItemLen[lstItemCount] = i1;
189 lstByteSize = ((lstItemCount + 1) *
sizeof(
UINT_PTR)) +
192 if (mswBuf->bytesUsed + lstByteSize > mswBuf->bytesMax)
196 lstDataPos = ((lstItemCount + 1) *
sizeof(
UINT_PTR)) +
200 lstDataPos += ptrofs;
202 for (i1 = 0; i1 < lstItemCount; i1++)
207 lstDataPos += lstItemLen[i1];
216 for (i1 = 0; i1 < lstItemCount; i1++)
223 return mswBuf->bufok;
BOOL mswBufferAppendPtr(_Inout_ PMSW_BUFFER mswBuf, _In_ void *ptr)
ACPI_SIZE strlen(const char *String)
BOOL mswBufferAppendStrA(_Inout_ PMSW_BUFFER mswBuf, _In_ char *str)
BYTE * mswBufferEndPtr(_Inout_ PMSW_BUFFER mswBuf)
unsigned __int3264 UINT_PTR
Referenced by mswBufferAppendBlob_Hostent(), and mswBufferAppendBlob_Servent().
◆ mswBufferAppendStrW()
Definition at line 78 of file mswhelper.c.
BOOL mswBufferAppend(_Inout_ PMSW_BUFFER mswBuf, _In_ void *dataToAppend, _In_ DWORD dataSize)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
Referenced by NSP_LookupServiceNextW().
◆ mswBufferCheck()
◆ mswBufferEndPtr()
◆ mswBufferIncUsed()
◆ mswBufferInit()
◆ StrA2WHeapAlloc()
◆ StrAryCpyHeapAllocA()
Definition at line 530 of file mswhelper.c.
551 while (*aSrcPtr !=
NULL)
556 bItmLen =
strlen(*aSrcPtr) + 1;
557 aStrByteLen[aCount] = bItmLen;
559 bLen +=
sizeof(*aSrcPtr) + bItmLen;
566 bLen +=
sizeof(*aSrcPtr);
576 aDstNextStr = (
char*)(resA + aCount + 1);
577 for (i1 = 0; i1 < aCount; i1++)
579 bItmLen = aStrByteLen[i1];
581 *aDstPtr = aDstNextStr;
ACPI_SIZE strlen(const char *String)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RtlCopyMemory(Destination, Source, Length)
Referenced by NSP_GetServiceByNameHeapAllocW().
◆ StrAryCpyHeapAllocWToA()
Definition at line 596 of file mswhelper.c.
619 while (*wSrcPtr !=
NULL)
624 bItmLen =
wcslen(*wSrcPtr) + 1;
625 aStrByteLen[aCount] = bItmLen;
627 bLen +=
sizeof(*wSrcPtr) + bItmLen;
634 bLen +=
sizeof(*wSrcPtr);
644 aDstNextStr = (
char*)(resA + aCount + 1);
645 for (i1 = 0; i1 < aCount; i1++)
647 bItmLen = aStrByteLen[i1];
649 *aDstPtr = aDstNextStr;
#define WideCharToMultiByte
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define RtlCopyMemory(Destination, Source, Length)
#define HeapFree(x, y, z)
Referenced by NSP_GetHostByNameHeapAllocW().
◆ StrCpyHeapAllocA()
Definition at line 507 of file mswhelper.c.
522 bLen = (chLen + 1) *
sizeof(
char);
ACPI_SIZE strlen(const char *String)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RtlCopyMemory(Destination, Source, Length)
◆ StrCpyHeapAllocW()
◆ StrW2AHeapAlloc()