Changeset 8052 for trunk/src/wnetap32/wnetap32.cpp
- Timestamp:
- Mar 8, 2002, 12:37:56 PM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/wnetap32/wnetap32.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wnetap32/wnetap32.cpp
r6676 r8052 1 /* $Id: wnetap32.cpp,v 1.1 6 2001-09-07 08:20:59 phallerExp $ */1 /* $Id: wnetap32.cpp,v 1.17 2002-03-08 11:37:10 sandervl Exp $ */ 2 2 3 3 /* … … 38 38 #include <winconst.h> 39 39 40 #include "wnetap32.h" 41 #include "lanman.h" 40 42 #include "oslibnet.h" 41 #include "lanman.h"42 43 43 44 ODINDEBUGCHANNEL(WNETAP32-WNETAP32) 45 46 47 extern DWORD WIN32API OSLibNetbiosHlpHandler(LPVOID lpParam); 44 48 45 49 … … 48 52 ****************************************************************************/ 49 53 50 #define NCBNAMSZ 1651 #define MAX_LANA 25452 53 typedef struct _NCB {54 UCHAR ncb_command;55 UCHAR ncb_retcode;56 UCHAR ncb_lsn;57 UCHAR ncb_num;58 PUCHAR ncb_buffer;59 WORD ncb_length;60 UCHAR ncb_callname[NCBNAMSZ];61 UCHAR ncb_name[NCBNAMSZ];62 UCHAR ncb_rto;63 UCHAR ncb_sto;64 void (* CALLBACK ncb_post)( struct _NCB * );65 UCHAR ncb_lana_num;66 UCHAR ncb_cmd_cplt;67 UCHAR ncb_reserve[10];68 HANDLE ncb_event;69 } NCB, *PNCB;70 71 #define NRC_GOODRET 0x0072 #define NRC_BUFLEN 0x0173 #define NRC_ILLCMD 0x0374 #define NRC_CMDTMO 0x0575 #define NRC_INCOMP 0x0676 #define NRC_BADDR 0x0777 #define NRC_SNUMOUT 0x0878 #define NRC_NORES 0x0979 #define NRC_SCLOSED 0x0a80 #define NRC_CMDCAN 0x0b81 #define NRC_DUPNAME 0x0d82 #define NRC_NAMTFUL 0x0e83 #define NRC_ACTSES 0x0f84 #define NRC_LOCTFUL 0x1185 #define NRC_REMTFUL 0x1286 #define NRC_ILLNN 0x1387 #define NRC_NOCALL 0x1488 #define NRC_NOWILD 0x1589 #define NRC_INUSE 0x1690 #define NRC_NAMERR 0x1791 #define NRC_SABORT 0x1892 #define NRC_NAMCONF 0x1993 #define NRC_IFBUSY 0x2194 #define NRC_TOOMANY 0x2295 #define NRC_BRIDGE 0x2396 #define NRC_CANOCCR 0x2497 #define NRC_CANCEL 0x2698 #define NRC_DUPENV 0x3099 #define NRC_ENVNOTDEF 0x34100 #define NRC_OSRESNOTAV 0x35101 #define NRC_MAXAPPS 0x36102 #define NRC_NOSAPS 0x37103 #define NRC_NORESOURCES 0x38104 #define NRC_INVADDRESS 0x39105 #define NRC_INVDDID 0x3B106 #define NRC_LOCKFAIL 0x3C107 #define NRC_OPENERR 0x3f108 #define NRC_SYSTEM 0x40109 110 #define NRC_PENDING 0xff111 112 54 113 55 //****************************************************************************** 56 // Note: 57 // The major difference between OS/2 and Win32 regarding NetBIOS is 58 // all operations and resources are per-process for Win32 and 59 // global for OS/2. So we might probably end up with stray netbios names etc. 60 // long after a process has vanished. 114 61 //****************************************************************************** 62 //#define NETBIOS_ENABLED 115 63 ODINFUNCTION1(UCHAR, OS2Netbios, 116 PNCB, pncb) 117 { 118 #ifdef DEBUG 119 WriteLog("OS2Netbios; pretend no network available\n"); 120 #endif 121 return(NRC_OPENERR); 122 } 123 //****************************************************************************** 124 //****************************************************************************** 64 PNCB_w, pncb) 65 { 66 #ifndef NETBIOS_ENABLED 67 pncb->ncb_retcode = NRC_OPENERR_w; 68 return pncb->ncb_retcode; 69 70 #else 71 UCHAR rc; 72 73 // Note: OS/2 specific documentation is found in DSSPGR1+DSSPGR2 74 75 // fork for asynchronous operation: 76 if (pncb->ncb_command & ASYNCH_w) 77 { 78 // either event or post may be specified 79 if ( (pncb->ncb_event != 0) && 80 (pncb->ncb_post != 0) ) 81 { 82 pncb->ncb_retcode = NRC_ILLCMD_w; 83 return NRC_ILLCMD_w; 84 } 85 86 87 // @@@PH 88 // we might go for one or more statically allocated 89 // worker threads instead of creating and destroying 90 // a thread for each single request. 91 92 // we're to start an ODIN thread ourself and do 93 // the operation itself synchronously! 94 95 // say the netbios operation is still pending ... 96 pncb->ncb_cmd_cplt = NRC_PENDING_w; 97 98 UCHAR ucCommand = pncb->ncb_command; 99 DWORD tidNetbios; 100 HANDLE hNetbiosThread = CreateThread(NULL, 101 0x8000, 102 OSLibNetbiosHlpHandler, 103 (LPVOID)pncb, 104 0, // thread creation flags 105 &tidNetbios); 106 if (hNetbiosThread == NULL) 107 { 108 // in case the thread could not be launched, 109 // return with error 110 pncb->ncb_retcode = NRC_SYSTEM_w; 111 pncb->ncb_cmd_cplt = NRC_SYSTEM_w; 112 return pncb->ncb_retcode; 113 } 114 else 115 { 116 dprintf(("NETBIOS: Netbios helper thread %d started for command %02xh\n", 117 tidNetbios, 118 ucCommand)); 119 120 // verify if the operation has completed already 121 if (pncb->ncb_cmd_cplt != NRC_PENDING_w) 122 { 123 // Docs say in this case return as if the request was synchronous 124 rc = pncb->ncb_retcode; 125 } 126 else 127 { 128 // this is the "operation pending" return code 129 rc = 0; 130 } 131 } 132 } 133 else 134 { 135 // verify request 136 if ( (pncb->ncb_event != 0) || 137 (pncb->ncb_post != 0) ) 138 { 139 pncb->ncb_retcode = NRC_ILLCMD_w; 140 return NRC_ILLCMD_w; 141 } 142 143 // call the Request Router 144 rc = OSLibNetBIOS( pncb ); 145 } 146 147 return( rc ); 148 #endif /* NETBIOS_ENABLED */ 149 } 150 125 151 126 152 /***************************************************************************** … … 1073 1099 * Name : NET_API_STATUS I_NetPathType 1074 1100 * Purpose : 1101 1075 1102 * Parameters: wrong 1076 1103 * Variables : … … 1096 1123 /***************************************************************************** 1097 1124 * Name : NET_API_STATUS NetapipBufferAllocate 1125 1098 1126 * Purpose : 1099 1127 * Parameters: wrong
Note:
See TracChangeset
for help on using the changeset viewer.
