- Timestamp:
- Oct 2, 2000, 3:03:32 PM (25 years ago)
- Location:
- trunk/src/wnetap32
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wnetap32/makefile
r3864 r4362 1 # $Id: makefile,v 1.1 2 2000-07-19 19:05:27 sandervlExp $1 # $Id: makefile,v 1.13 2000-10-02 13:03:00 phaller Exp $ 2 2 3 3 # … … 25 25 OBJS = \ 26 26 $(OBJDIR)\wnetap32.obj \ 27 $(OBJDIR)\oslibnet.obj \ 27 28 $(OBJDIR)\netapi32rsrc.obj \ 28 29 $(PDWIN32_LIB)/dllentry.obj -
trunk/src/wnetap32/netapi32.def
r2650 r4362 1 ; $Id: netapi32.def,v 1. 1 2000-02-05 02:19:03 sandervlExp $1 ; $Id: netapi32.def,v 1.2 2000-10-02 13:03:01 phaller Exp $ 2 2 3 3 LIBRARY WNETAP32 INITINSTANCE 4 4 DATA MULTIPLE NONSHARED 5 6 IMPORTS 7 Net32WkstaGetInfo = NETAPI32.146 8 Net32WkstaSetInfo = NETAPI32.147 5 9 6 10 EXPORTS -
trunk/src/wnetap32/wnetap32.cpp
r579 r4362 1 /* $Id: wnetap32.cpp,v 1. 6 1999-08-19 13:13:24phaller Exp $ */1 /* $Id: wnetap32.cpp,v 1.7 2000-10-02 13:03:01 phaller Exp $ */ 2 2 3 3 /* … … 10 10 * 11 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. 12 17 * 13 18 */ … … 24 29 ****************************************************************************/ 25 30 31 #include <odin.h> 32 #include <odinwrap.h> 33 #include <os2sel.h> 26 34 #include <os2win.h> 27 #include <odinwrap.h> 28 #include "misc.h" 29 30 31 ODINDEBUGCHANNEL(WNETAP32) 35 #include <misc.h> 36 #include <heapstring.h> 37 38 #include "oslibnet.h" 39 #include "lmwksta.h" 40 41 ODINDEBUGCHANNEL(WNETAP32-WNETAP32) 42 32 43 33 44 /**************************************************************************** … … 38 49 #define NET_API_STATUS DWORD 39 50 51 #define NERR_OK 0 40 52 #define NERR_BASE 1 /* @@@PH DUMMY ! */ 41 53 … … 197 209 198 210 { 199 dprintf(("NETAPI32: NetApiBufferAllocate not implemented\n")); 200 201 return (NERR_BASE); 211 *Buffer = HEAP_malloc(ByteCount); 212 return (NERR_OK); 202 213 } 203 214 … … 221 232 222 233 { 223 dprintf(("NETAPI32: NetApiBufferFree not implemented\n")); 224 225 return (NERR_BASE); 234 HEAP_free(Buffer); 235 return (NERR_OK); 226 236 } 227 237 … … 246 256 LPVOID, OldBuffer, 247 257 DWORD, NewByteCount, 248 LPVOID, NewBuffer) 249 { 250 251 dprintf(("NETAPI32: NetApiBufferReallocate not implemented\n")); 252 253 return (NERR_BASE); 258 LPVOID*, NewBuffer) 259 { 260 *NewBuffer = HEAP_realloc(OldBuffer, NewByteCount); 261 return (NERR_OK); 254 262 } 255 263 … … 272 280 ODINFUNCTION2(NET_API_STATUS, OS2NetApiBufferSize, 273 281 LPVOID, buffer, 274 DWORD, ByteCount) 275 { 276 277 dprintf(("NETAPI32: NetApiBufferSize not implemented\n")); 278 279 return (NERR_BASE); 282 LPDWORD, lpByteCount) 283 { 284 *lpByteCount = HEAP_size(buffer); 285 return (NERR_OK); 280 286 } 281 287 … … 2763 2769 * Variables : 2764 2770 * Result : 2765 * Remark : 2771 * Remark : NT understands modes 100, 101, 102, 302, 402, and 502 2772 * The APIs allocate the buffer dynamically. 2766 2773 * Status : UNTESTED STUB 2767 2774 * … … 2776 2783 2777 2784 { 2778 2779 dprintf(("NETAPI32: NetWkstaGetInfo(%s, %d, %08x) not implemented\n" 2785 dprintf(("NETAPI32: NetWkstaGetInfo(%s, %d, %08x)\n" 2780 2786 ,servername, level, *bufptr 2781 2787 )); 2782 2783 return (NERR_BASE); 2788 2789 // Convert servername to ASCII 2790 char *asciiServername = NULL; 2791 if (servername) asciiServername = UnicodeToAsciiString(servername); 2792 2793 // @@@PH convert information modes! 2794 int iOS2Level = 100; 2795 switch (level) 2796 { 2797 case 100: iOS2Level = 10; break; 2798 case 101: iOS2Level = 1; break; 2799 case 102: iOS2Level = 1; break; 2800 case 302: iOS2Level = 1; break; 2801 case 402: iOS2Level = 1; break; 2802 case 502: iOS2Level = 1; break; 2803 } 2804 2805 ULONG ulBytesAvailable; 2806 DWORD rc; 2807 2808 // determine required size of buffer 2809 char pOS2Buffer[4096]; 2810 rc = OSLibNetWkstaGetInfo((const unsigned char*)asciiServername, 2811 iOS2Level, 2812 (unsigned char*)pOS2Buffer, 2813 sizeof(pOS2Buffer), 2814 &ulBytesAvailable); 2815 if (asciiServername) FreeAsciiString(asciiServername); 2816 2817 if (rc == NERR_OK) 2818 { 2819 // @@@PH now convert the requested structure to UNICODE 2820 switch (level) 2821 { 2822 case 100: // system information - guest access 2823 { 2824 PWKSTA_INFO_100 pwki100; 2825 struct wksta_info_10 *pOS2wki10 = (struct wksta_info_10 *)pOS2Buffer; 2826 2827 rc = OS2NetApiBufferAllocate(sizeof(pwki100), (LPVOID*)&pwki100); 2828 if (!rc) 2829 { 2830 pwki100->wki100_platform_id = 0; //@@@PH dummy 2831 pwki100->wki100_computername = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)pOS2wki10->wki10_computername); 2832 pwki100->wki100_langroup = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)pOS2wki10->wki10_langroup); 2833 pwki100->wki100_ver_major = pOS2wki10->wki10_ver_major; 2834 pwki100->wki100_ver_minor = pOS2wki10->wki10_ver_minor; 2835 } 2836 2837 // the caller is responsible for freeing the memory! 2838 *bufptr = (LPBYTE)pwki100; 2839 break; 2840 } 2841 2842 2843 case 101: // system information - guest access 2844 { 2845 PWKSTA_INFO_101 pwki101; 2846 struct wksta_info_1 *pOS2wki1 = (struct wksta_info_1 *)pOS2Buffer; 2847 2848 rc = OS2NetApiBufferAllocate(sizeof(pwki101), (LPVOID*)&pwki101); 2849 if (!rc) 2850 { 2851 pwki101->wki101_platform_id = 0; //@@@PH dummy 2852 pwki101->wki101_computername = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)pOS2wki1->wki1_computername); 2853 pwki101->wki101_langroup = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)pOS2wki1->wki1_langroup); 2854 pwki101->wki101_ver_major = pOS2wki1->wki1_ver_major; 2855 pwki101->wki101_ver_minor = pOS2wki1->wki1_ver_minor; 2856 pwki101->wki101_lanroot = HEAP_strdupAtoW ( GetProcessHeap(), 0, (LPCSTR)pOS2wki1->wki1_root); 2857 } 2858 2859 // the caller is responsible for freeing the memory! 2860 *bufptr = (LPBYTE)pwki101; 2861 break; 2862 } 2863 2864 2865 case 102: // system information - guest access 2866 { 2867 PWKSTA_INFO_102 pwki102; 2868 struct wksta_info_1 *pOS2wki1 = (struct wksta_info_1 *)pOS2Buffer; 2869 2870 rc = OS2NetApiBufferAllocate(sizeof(pwki102), (LPVOID*)&pwki102); 2871 if (!rc) 2872 { 2873 pwki102->wki102_platform_id = 0; //@@@PH dummy 2874 pwki102->wki102_computername = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)pOS2wki1->wki1_computername); 2875 pwki102->wki102_langroup = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)pOS2wki1->wki1_langroup); 2876 pwki102->wki102_ver_major = pOS2wki1->wki1_ver_major; 2877 pwki102->wki102_ver_minor = pOS2wki1->wki1_ver_minor; 2878 pwki102->wki102_lanroot = HEAP_strdupAtoW ( GetProcessHeap(), 0, (LPCSTR)pOS2wki1->wki1_root); 2879 pwki102->wki102_logged_on_users = 0; // @@@PH dummy 2880 } 2881 2882 // the caller is responsible for freeing the memory! 2883 *bufptr = (LPBYTE)pwki102; 2884 break; 2885 } 2886 2887 2888 case 502: // system information - guest access 2889 { 2890 PWKSTA_INFO_502 pwki502; 2891 struct wksta_info_1 *pOS2wki1 = (struct wksta_info_1 *)pOS2Buffer; 2892 2893 rc = OS2NetApiBufferAllocate(sizeof(pwki502), (LPVOID*)&pwki502);; 2894 if (!rc) 2895 { 2896 char *hs = (char *)pOS2wki1->wki1_wrkheuristics; 2897 2898 pwki502->wki502_char_wait = pOS2wki1->wki1_charwait; 2899 pwki502->wki502_collection_time = pOS2wki1->wki1_chartime; 2900 pwki502->wki502_maximum_collection_count = pOS2wki1->wki1_charcount; 2901 pwki502->wki502_keep_conn = pOS2wki1->wki1_keepconn; 2902 pwki502->wki502_max_cmds = pOS2wki1->wki1_maxcmds; 2903 pwki502->wki502_sess_timeout = pOS2wki1->wki1_sesstimeout; 2904 pwki502->wki502_siz_char_buf = pOS2wki1->wki1_sizcharbuf; 2905 pwki502->wki502_max_threads = pOS2wki1->wki1_maxthreads; 2906 2907 pwki502->wki502_lock_quota = 0; 2908 pwki502->wki502_lock_increment = 0; 2909 pwki502->wki502_lock_maximum = 0; 2910 pwki502->wki502_pipe_increment = 0; 2911 pwki502->wki502_pipe_maximum = 0; 2912 pwki502->wki502_cache_file_timeout = 0; 2913 pwki502->wki502_dormant_file_limit = 0; 2914 pwki502->wki502_read_ahead_throughput = 0; 2915 2916 pwki502->wki502_num_mailslot_buffers = pOS2wki1->wki1_mailslots; 2917 pwki502->wki502_num_srv_announce_buffers = pOS2wki1->wki1_numdgrambuf; 2918 pwki502->wki502_max_illegal_datagram_events = 0; 2919 pwki502->wki502_illegal_datagram_event_reset_frequency = 0; 2920 pwki502->wki502_log_election_packets = FALSE; 2921 2922 pwki502->wki502_use_opportunistic_locking = (hs[0] != '0') ? TRUE : FALSE; 2923 pwki502->wki502_use_unlock_behind = (hs[1] != '0') ? TRUE : FALSE; 2924 pwki502->wki502_use_close_behind = (hs[2] != '0') ? TRUE : FALSE; 2925 pwki502->wki502_buf_named_pipes = (hs[3] != '0') ? TRUE : FALSE; 2926 pwki502->wki502_use_lock_read_unlock = (hs[4] != '0') ? TRUE : FALSE; 2927 pwki502->wki502_utilize_nt_caching = TRUE; // sure we do ;-) 2928 pwki502->wki502_use_raw_read = (hs[12] != '0') ? TRUE : FALSE; 2929 pwki502->wki502_use_raw_write = (hs[13] != '0') ? TRUE : FALSE; 2930 pwki502->wki502_use_write_raw_data = (hs[29] != '0') ? TRUE : FALSE; 2931 pwki502->wki502_use_encryption = (hs[21] != '0') ? TRUE : FALSE; 2932 pwki502->wki502_buf_files_deny_write = (hs[23] != '0') ? TRUE : FALSE; 2933 pwki502->wki502_buf_read_only_files = (hs[24] != '0') ? TRUE : FALSE; 2934 pwki502->wki502_force_core_create_mode = (hs[27] != '0') ? TRUE : FALSE; 2935 pwki502->wki502_use_512_byte_max_transfer = FALSE; // @@@PH 2936 } 2937 2938 // the caller is responsible for freeing the memory! 2939 *bufptr = (LPBYTE)pwki502; 2940 break; 2941 } 2942 } 2943 } 2944 2945 // @@@PH convert return code to NT code 2946 return (rc); 2784 2947 } 2785 2948
Note:
See TracChangeset
for help on using the changeset viewer.