| 1 | /* $Id: mem.cpp,v 1.1 2001-09-06 22:23:39 phaller Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * | 
|---|
| 5 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 6 | * | 
|---|
| 7 | */ | 
|---|
| 8 | /* | 
|---|
| 9 | * NETAPI32 stubs | 
|---|
| 10 | * | 
|---|
| 11 | * Copyright 1998 Patrick Haller | 
|---|
| 12 | * | 
|---|
| 13 | * Note: functions that return structures/buffers seem to append strings | 
|---|
| 14 | * at the end of the buffer. Currently, we just allocate the strings | 
|---|
| 15 | * "normally". Therefore a caller that just does a NetApiBufferFree() on the | 
|---|
| 16 | * returned buffer will leak all allocated strings. | 
|---|
| 17 | * | 
|---|
| 18 | */ | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | /**************************************************************************** | 
|---|
| 22 | * Includes                                                                 * | 
|---|
| 23 | ****************************************************************************/ | 
|---|
| 24 |  | 
|---|
| 25 | #include <odin.h> | 
|---|
| 26 | #include <odinwrap.h> | 
|---|
| 27 | #include <os2win.h> | 
|---|
| 28 | #include <misc.h> | 
|---|
| 29 | #include <string.h> | 
|---|
| 30 | #include <unicode.h> | 
|---|
| 31 | #include <heapstring.h> | 
|---|
| 32 | #include <winconst.h> | 
|---|
| 33 |  | 
|---|
| 34 | #include "oslibnet.h" | 
|---|
| 35 | #include "lanman.h" | 
|---|
| 36 |  | 
|---|
| 37 | ODINDEBUGCHANNEL(WNETAP32-BUFFER) | 
|---|
| 38 |  | 
|---|
| 39 |  | 
|---|
| 40 | /**************************************************************************** | 
|---|
| 41 | * Module Global Variables                                                  * | 
|---|
| 42 | ****************************************************************************/ | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 | /***************************************************************************** | 
|---|
| 46 | * Name      : NET_API_STATUS NetApiBufferAllocate | 
|---|
| 47 | * Purpose   : | 
|---|
| 48 | * Parameters: DWORD ByteCount | 
|---|
| 49 | *             LPVOID *Buffer | 
|---|
| 50 | * Variables : | 
|---|
| 51 | * Result    : | 
|---|
| 52 | * Remark    : | 
|---|
| 53 | * Status    : UNTESTED STUB | 
|---|
| 54 | * | 
|---|
| 55 | * Stub Generated through PE2LX Stubwizard 0.02 from Markus Montkowski | 
|---|
| 56 | * | 
|---|
| 57 | * Author    : Markus Montkowski [09.07.98 19:46:46] | 
|---|
| 58 | *****************************************************************************/ | 
|---|
| 59 |  | 
|---|
| 60 | ODINFUNCTION2(NET_API_STATUS, OS2NetApiBufferAllocate, | 
|---|
| 61 | DWORD, ByteCount, | 
|---|
| 62 | LPVOID *, Buffer) | 
|---|
| 63 |  | 
|---|
| 64 | { | 
|---|
| 65 | *Buffer = HEAP_malloc(ByteCount); | 
|---|
| 66 | return (NERR_OK); | 
|---|
| 67 | } | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 | /***************************************************************************** | 
|---|
| 71 | * Name      : NET_API_STATUS NetApiBufferFree | 
|---|
| 72 | * Purpose   : | 
|---|
| 73 | * Parameters: LPVOID Buffer | 
|---|
| 74 | * Variables : | 
|---|
| 75 | * Result    : | 
|---|
| 76 | * Remark    : | 
|---|
| 77 | * Status    : UNTESTED STUB | 
|---|
| 78 | * | 
|---|
| 79 | * Stub Generated through PE2LX Stubwizard 0.02 from Markus Montkowski | 
|---|
| 80 | * | 
|---|
| 81 | * Author    : Markus Montkowski [09.07.98 19:47:21] | 
|---|
| 82 | *****************************************************************************/ | 
|---|
| 83 |  | 
|---|
| 84 | ODINFUNCTION1(NET_API_STATUS, OS2NetApiBufferFree, | 
|---|
| 85 | LPVOID, Buffer) | 
|---|
| 86 |  | 
|---|
| 87 | { | 
|---|
| 88 | HEAP_free(Buffer); | 
|---|
| 89 | return (NERR_OK); | 
|---|
| 90 | } | 
|---|
| 91 |  | 
|---|
| 92 |  | 
|---|
| 93 | /***************************************************************************** | 
|---|
| 94 | * Name      : NET_API_STATUS NetApiBufferReallocate | 
|---|
| 95 | * Purpose   : | 
|---|
| 96 | * Parameters: LPVOID OldBuffer | 
|---|
| 97 | *             DWORD NewByteCount | 
|---|
| 98 | *             LPVOID NewBuffer | 
|---|
| 99 | * Variables : | 
|---|
| 100 | * Result    : | 
|---|
| 101 | * Remark    : | 
|---|
| 102 | * Status    : UNTESTED STUB | 
|---|
| 103 | * | 
|---|
| 104 | * Stub Generated through PE2LX Stubwizard 0.02 from Markus Montkowski | 
|---|
| 105 | * | 
|---|
| 106 | * Author    : Markus Montkowski [09.07.98 21:25:21] | 
|---|
| 107 | *****************************************************************************/ | 
|---|
| 108 |  | 
|---|
| 109 | ODINFUNCTION3(NET_API_STATUS, OS2NetApiBufferReallocate, | 
|---|
| 110 | LPVOID, OldBuffer, | 
|---|
| 111 | DWORD, NewByteCount, | 
|---|
| 112 | LPVOID*, NewBuffer) | 
|---|
| 113 | { | 
|---|
| 114 | *NewBuffer = HEAP_realloc(OldBuffer, NewByteCount); | 
|---|
| 115 | return (NERR_OK); | 
|---|
| 116 | } | 
|---|
| 117 |  | 
|---|
| 118 |  | 
|---|
| 119 | /***************************************************************************** | 
|---|
| 120 | * Name      : NET_API_STATUS NetApiBufferSize | 
|---|
| 121 | * Purpose   : | 
|---|
| 122 | * Parameters: LPVOID buffer | 
|---|
| 123 | *             DWORD ByteCount | 
|---|
| 124 | * Variables : | 
|---|
| 125 | * Result    : | 
|---|
| 126 | * Remark    : | 
|---|
| 127 | * Status    : UNTESTED STUB | 
|---|
| 128 | * | 
|---|
| 129 | * Stub Generated through PE2LX Stubwizard 0.02 from Markus Montkowski | 
|---|
| 130 | * | 
|---|
| 131 | * Author    : Markus Montkowski [09.07.98 21:25:44] | 
|---|
| 132 | *****************************************************************************/ | 
|---|
| 133 |  | 
|---|
| 134 | ODINFUNCTION2(NET_API_STATUS, OS2NetApiBufferSize, | 
|---|
| 135 | LPVOID, buffer, | 
|---|
| 136 | LPDWORD, lpByteCount) | 
|---|
| 137 | { | 
|---|
| 138 | *lpByteCount = HEAP_size(buffer); | 
|---|
| 139 | return (NERR_OK); | 
|---|
| 140 | } | 
|---|