Go to the source code of this file.
|
void | mswBufferInit (_Out_ 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 deltaofs) |
|
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 **aStrAry) |
|
◆ PMSW_BUFFER
◆ mswBufferAppend()
◆ mswBufferAppendAddr_AddrInfoW()
Definition at line 352 of file mswhelper.c.
355{
358
359 lpRes->dwNumberOfCsAddrs = 1;
361
362 paddrinfo = lpRes->lpcsaBuffer;
363
366
368
371
373
376
379
384 psa->sin_addr.s_addr = 0;
386
391 psa->sin_addr.s_addr = ip4addr;
393
395}
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
BOOL mswBufferIncUsed(_Inout_ PMSW_BUFFER mswBuf, _In_ DWORD count)
BYTE * mswBufferEndPtr(_Inout_ PMSW_BUFFER mswBuf)
SOCKET_ADDRESS RemoteAddr
#define RtlZeroMemory(Destination, Length)
struct sockaddr_in * LPSOCKADDR_IN
struct sockaddr * LPSOCKADDR
struct _CSADDR_INFO * LPCSADDR_INFO
Referenced by NSP_LookupServiceNextW().
◆ mswBufferAppendBlob_Hostent()
Definition at line 227 of file mswhelper.c.
232{
234 void* lst[2];
236
237
239
242
243
244 lpRes->lpBlob->cbSize = 0;
246
247
248 phe = (
PHOSTENT)lpRes->lpBlob->pBlobData;
250
253
256
257
259
260 if (hostAliasesA)
261 {
263 (void**)hostAliasesA,
266 }
267 else
268 {
271 }
272
273
275
276 lst[0] = (void*)&ip4addr;
277
279
282
283
285
288
290 return mswBuf->bufok;
291}
BOOL mswBufferAppendLst(_Inout_ PMSW_BUFFER mswBuf, _In_ void **lst, _In_ DWORD itemByteLength, _In_opt_ int ptrofs)
BOOL mswBufferAppendStrA(_Inout_ PMSW_BUFFER mswBuf, _In_ char *str)
BOOL mswBufferAppendPtr(_Inout_ PMSW_BUFFER mswBuf, _In_ void *ptr)
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.
300{
303
304
306
309
310 lpRes->lpBlob->cbSize = 0;
312
313
314 pse = (
LPSERVENT)lpRes->lpBlob->pBlobData;
316
319
321
322 if (serviceAliasesA)
323 {
325 (void**)serviceAliasesA,
328 }
329 else
330 {
333 }
334
336
339
341
343
346
348 return mswBuf->bufok;
349}
struct servent * LPSERVENT
Referenced by NSP_LookupServiceNextW().
◆ mswBufferAppendLst()
Definition at line 104 of file mswhelper.c.
108{
114
115
117 lstItemCount = 0;
119 {
120 lstItemCount++;
121 ptrSrcLstPos++;
122 }
123
124 lstByteSize = ((lstItemCount + 1) *
sizeof(
UINT_PTR)) +
125 (lstItemCount * itemByteLength);
126
127 if (mswBuf->bytesUsed + lstByteSize > mswBuf->bytesMax)
129
130
131 lstDataPos = ((lstItemCount + 1) *
sizeof(
UINT_PTR)) +
133
134 lstDataPos += ptrofs;
135
136
137 for (i1 = 0; i1 < lstItemCount; i1++)
138 {
141
143 }
144
145
148
149
151 for (i1 = 0; i1 < lstItemCount; i1++)
152 {
154 ptrSrcLstPos++;
155 }
156 return mswBuf->bufok;
157}
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.
163{
171
172
174 lstItemCount = 0;
175 lstDataSize = 0;
176
178 {
181
182 i1 =
strlen((
char*)*ptrSrcLstPos) +
sizeof(
char);
183 lstItemLen[lstItemCount] = i1;
184 lstItemCount++;
185 lstDataSize += i1;
186 ptrSrcLstPos++;
187 }
188
189 lstByteSize = ((lstItemCount + 1) *
sizeof(
UINT_PTR)) +
190 lstDataSize;
191
192 if (mswBuf->bytesUsed + lstByteSize > mswBuf->bytesMax)
194
195
196 lstDataPos = ((lstItemCount + 1) *
sizeof(
UINT_PTR)) +
198
199
200 lstDataPos += ptrofs;
201
202 for (i1 = 0; i1 < lstItemCount; i1++)
203 {
206
207 lstDataPos += lstItemLen[i1];
208 }
209
210
213
214
216 for (i1 = 0; i1 < lstItemCount; i1++)
217 {
220
221 ptrSrcLstPos++;
222 }
223 return mswBuf->bufok;
224}
Referenced by mswBufferAppendBlob_Hostent(), and mswBufferAppendBlob_Servent().
◆ mswBufferAppendStrW()
◆ mswBufferCheck()
◆ mswBufferEndPtr()
◆ mswBufferIncUsed()
◆ mswBufferInit()
◆ StrA2WHeapAlloc()
Definition at line 399 of file mswhelper.c.
401{
402 int aStrByteLen;
403 int wStrByteLen;
404 int charLen;
407
410
411 charLen =
strlen(aStr) + 1;
412
413 aStrByteLen = (charLen *
sizeof(
char));
414 wStrByteLen = (charLen *
sizeof(
WCHAR));
415
416 if (hHeap == 0)
418
421 {
424 }
425
427 0,
428 aStr,
429 aStrByteLen,
430 wStr,
431 charLen);
432
434 {
437 }
438 return wStr;
439}
#define HeapFree(x, y, z)
#define MultiByteToWideChar
Referenced by NSP_GetServiceByNameHeapAllocW(), and NSP_LookupServiceBeginW().
◆ StrAryCpyHeapAllocA()
Definition at line 530 of file mswhelper.c.
532{
533 char** aSrcPtr;
534 char** aDstPtr;
535 char* aDstNextStr;
537 size_t bLen;
538 size_t bItmLen;
539 int aCount;
540 int i1;
541 char** resA;
542
543 if (hHeap == 0)
545
546
547 aSrcPtr = aStrAry;
548 bLen = 0;
549 aCount = 0;
550
551 while (*aSrcPtr !=
NULL)
552 {
555
556 bItmLen =
strlen(*aSrcPtr) + 1;
557 aStrByteLen[aCount] = bItmLen;
558
559 bLen += sizeof(*aSrcPtr) + bItmLen;
560
561 aSrcPtr++;
562 aCount++;
563 }
564
565
566 bLen += sizeof(*aSrcPtr);
567
568
570
571
572 aSrcPtr = aStrAry;
573 aDstPtr = resA;
574
575
576 aDstNextStr = (char*)(resA + aCount + 1);
577 for (i1 = 0; i1 < aCount; i1++)
578 {
579 bItmLen = aStrByteLen[i1];
580
581 *aDstPtr = aDstNextStr;
583
585 aDstPtr++;
586 aSrcPtr++;
587 }
588
589
591
592 return resA;
593}
Referenced by NSP_GetServiceByNameHeapAllocW().
◆ StrAryCpyHeapAllocWToA()
Definition at line 596 of file mswhelper.c.
598{
600 char** aDstPtr;
601 char* aDstNextStr;
603 int bLen;
604 int bItmLen;
605 int aCount;
606 int i1;
607 char** resA;
609 char* aStr;
610
611 if (hHeap == 0)
613
614
615 wSrcPtr = wStrAry;
616 bLen = 0;
617 aCount = 0;
618
619 while (*wSrcPtr !=
NULL)
620 {
623
624 bItmLen =
wcslen(*wSrcPtr) + 1;
625 aStrByteLen[aCount] = bItmLen;
626
627 bLen += sizeof(*wSrcPtr) + bItmLen;
628
629 wSrcPtr++;
630 aCount++;
631 }
632
633
634 bLen += sizeof(*wSrcPtr);
635
636
638
639
640 wSrcPtr = wStrAry;
641 aDstPtr = resA;
642
643
644 aDstNextStr = (char*)(resA + aCount + 1);
645 for (i1 = 0; i1 < aCount; i1++)
646 {
647 bItmLen = aStrByteLen[i1];
648
649 *aDstPtr = aDstNextStr;
650
653 {
656 }
657
659 0,
660 *wSrcPtr,
661 bItmLen,
662 aStr,
663 bItmLen,
667 {
670 }
673
675 aDstPtr++;
676 wSrcPtr++;
677 }
678
679
681
682 return resA;
683}
#define WideCharToMultiByte
Referenced by NSP_GetHostByNameHeapAllocW().
◆ StrCpyHeapAllocA()
Definition at line 507 of file mswhelper.c.
509{
510 size_t chLen;
511 size_t bLen;
512 char* resA;
513
516
517 if (hHeap == 0)
519
521
522 bLen = (chLen + 1) * sizeof(char);
523
526 return resA;
527}
◆ StrCpyHeapAllocW()
◆ StrW2AHeapAlloc()
Definition at line 442 of file mswhelper.c.
444{
445 int charLen;
446 int aStrByteLen;
448 char* aStr;
449
452
453 charLen =
wcslen(wStr) + 1;
454
455 aStrByteLen = (charLen *
sizeof(
char));
456
457 if (hHeap == 0)
459
462 {
465 }
466
468 0,
469 wStr,
470 charLen,
471 aStr,
472 aStrByteLen,
475 if (
ret != aStrByteLen)
476 {
479 }
480 return aStr;
481}
Referenced by NSP_GetServiceByNameHeapAllocW(), and NSP_LookupServiceNextW().