|
|
1.1 root 1: /* SMBLIB.H */
2:
1.1.1.2 ! root 3: /* Developed 1990-2000 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
1.1 root 4:
5: #ifndef _SMBLIB_H
6: #define _SMBLIB_H
7:
1.1.1.2 ! root 8: #include "lzh.h"
! 9:
! 10: #if defined(__WATCOMC__) || defined(__TURBOC__) || defined(_MSC_VER)
1.1 root 11: # include <io.h>
12: # include <share.h>
1.1.1.2 ! root 13: #endif
! 14:
! 15: #if defined(__WATCOMC__) || defined(__TURBOC__)
! 16: # include <mem.h>
1.1 root 17: #else
18: # include <memory.h>
19: #endif
20:
21: #if defined(__WATCOMC__)
22: # include <dos.h>
23: #elif defined(__TURBOC__)
24: # include <dir.h>
25: #endif
26:
1.1.1.2 ! root 27: #if defined(_WIN32)
! 28: # ifndef __FLAT__
! 29: # define __FLAT__
! 30: # endif
! 31: # define SMBCALL __stdcall /* VB Compatible */
! 32: # if defined (EXPORT32)
! 33: # undef EXPORT32
! 34: # endif
! 35: # if defined(SMBDLL)
! 36: # define EXPORT32 __declspec( dllexport )
! 37: # else
! 38: # define EXPORT32 __declspec( dllimport )
! 39: # endif
1.1 root 40: #elif defined(__FLAT__)
1.1.1.2 ! root 41: # if defined(SMBDLL)
! 42: # define SMBCALL _pascal
! 43: # define EXPORT32 _export
! 44: # else
! 45: # define SMBCALL
! 46: # define EXPORT32
! 47: # endif
! 48: #
1.1 root 49: #else
50: # define SMBCALL
1.1.1.2 ! root 51: # define EXPORT32
1.1 root 52: #endif
53:
54: #include <malloc.h>
55: #include <time.h>
56: #include <errno.h>
57: #include <fcntl.h>
58: #include <stdio.h>
59: #include <stdlib.h>
60: #include <string.h>
61: #include <sys/stat.h>
62: #include <sys/types.h>
63:
64: #include "smbdefs.h"
65:
66: #define SMB_STACK_LEN 4 /* Max msg bases in smb_stack() */
67: #define SMB_STACK_POP 0 /* Pop a msg base off of smb_stack() */
68: #define SMB_STACK_PUSH 1 /* Push a msg base onto smb_stack() */
69: #define SMB_STACK_XCHNG 2 /* Exchange msg base w/last pushed */
70:
71: #define GETMSGTXT_TAILS 1 /* Get message tail(s) too */
72:
1.1.1.2 ! root 73: #ifdef __cplusplus
! 74: extern "C" {
! 75: #endif
1.1 root 76:
1.1.1.2 ! root 77: EXPORT32 int SMBCALL smb_ver(void);
! 78: EXPORT32 char * SMBCALL smb_lib_ver(void);
! 79: EXPORT32 int SMBCALL smb_open(smb_t *smb);
! 80: EXPORT32 void SMBCALL smb_close(smb_t *smb);
! 81: EXPORT32 int SMBCALL smb_open_da(smb_t *smb);
! 82: EXPORT32 void SMBCALL smb_close_da(smb_t *smb);
! 83: EXPORT32 int SMBCALL smb_open_ha(smb_t *smb);
! 84: EXPORT32 void SMBCALL smb_close_ha(smb_t *smb);
! 85: EXPORT32 int SMBCALL smb_create(smb_t *smb);
! 86: EXPORT32 int SMBCALL smb_stack(smb_t *smb, int op);
! 87: EXPORT32 int SMBCALL smb_trunchdr(smb_t *smb);
! 88: EXPORT32 int SMBCALL smb_locksmbhdr(smb_t *smb);
! 89: EXPORT32 int SMBCALL smb_getstatus(smb_t *smb);
! 90: EXPORT32 int SMBCALL smb_putstatus(smb_t *smb);
! 91: EXPORT32 int SMBCALL smb_unlocksmbhdr(smb_t *smb);
! 92: EXPORT32 int SMBCALL smb_getmsgidx(smb_t *smb, smbmsg_t *msg);
! 93: EXPORT32 int SMBCALL smb_getlastidx(smb_t *smb, idxrec_t *idx);
! 94: EXPORT32 uint SMBCALL smb_getmsghdrlen(smbmsg_t *msg);
! 95: EXPORT32 ulong SMBCALL smb_getmsgdatlen(smbmsg_t *msg);
! 96: EXPORT32 int SMBCALL smb_lockmsghdr(smb_t *smb, smbmsg_t *msg);
! 97: EXPORT32 int SMBCALL smb_getmsghdr(smb_t *smb, smbmsg_t *msg);
! 98: EXPORT32 int SMBCALL smb_unlockmsghdr(smb_t *smb, smbmsg_t *msg);
! 99: EXPORT32 int SMBCALL smb_addcrc(smb_t *smb, ulong crc);
! 100: EXPORT32 int SMBCALL smb_hfield(smbmsg_t *msg, ushort type, ushort length, void *data);
! 101: EXPORT32 int SMBCALL smb_dfield(smbmsg_t *msg, ushort type, ulong length);
! 102: EXPORT32 int SMBCALL smb_addmsghdr(smb_t *smb, smbmsg_t *msg,int storage);
! 103: EXPORT32 int SMBCALL smb_putmsg(smb_t *smb, smbmsg_t *msg);
! 104: EXPORT32 int SMBCALL smb_putmsgidx(smb_t *smb, smbmsg_t *msg);
! 105: EXPORT32 int SMBCALL smb_putmsghdr(smb_t *smb, smbmsg_t *msg);
! 106: EXPORT32 void SMBCALL smb_freemsgmem(smbmsg_t *msg);
! 107: EXPORT32 ulong SMBCALL smb_hdrblocks(ulong length);
! 108: EXPORT32 ulong SMBCALL smb_datblocks(ulong length);
! 109: EXPORT32 long SMBCALL smb_allochdr(smb_t *smb, ulong length);
! 110: EXPORT32 long SMBCALL smb_fallochdr(smb_t *smb, ulong length);
! 111: EXPORT32 long SMBCALL smb_hallochdr(smb_t *smb);
! 112: EXPORT32 long SMBCALL smb_allocdat(smb_t *smb, ulong length, ushort headers);
! 113: EXPORT32 long SMBCALL smb_fallocdat(smb_t *smb, ulong length, ushort headers);
! 114: EXPORT32 long SMBCALL smb_hallocdat(smb_t *smb);
! 115: EXPORT32 int SMBCALL smb_incdat(smb_t *smb, ulong offset, ulong length, ushort headers);
! 116: EXPORT32 int SMBCALL smb_freemsg(smb_t *smb, smbmsg_t *msg);
! 117: EXPORT32 int SMBCALL smb_freemsgdat(smb_t *smb, ulong offset, ulong length, ushort headers);
! 118: EXPORT32 int SMBCALL smb_freemsghdr(smb_t *smb, ulong offset, ulong length);
! 119: EXPORT32 void SMBCALL smb_freemsgtxt(char HUGE16 *buf);
! 120: EXPORT32 char HUGE16 * SMBCALL smb_getmsgtxt(smb_t *smb, smbmsg_t *msg, ulong mode);
1.1 root 121:
1.1.1.2 ! root 122: /* FILE pointer I/O functions */
1.1 root 123:
1.1.1.2 ! root 124: EXPORT32 int SMBCALL smb_feof(FILE *fp);
! 125: EXPORT32 int SMBCALL smb_ferror(FILE *fp);
! 126: EXPORT32 int SMBCALL smb_fflush(FILE *fp);
! 127: EXPORT32 int SMBCALL smb_fgetc(FILE *fp);
! 128: EXPORT32 int SMBCALL smb_fputc(int ch, FILE *fp);
! 129: EXPORT32 int SMBCALL smb_fseek(FILE *fp, long offset, int whence);
! 130: EXPORT32 long SMBCALL smb_ftell(FILE *fp);
! 131: EXPORT32 long SMBCALL smb_fread(void HUGE16 *buf, long bytes, FILE *fp);
! 132: EXPORT32 long SMBCALL smb_fwrite(void HUGE16 *buf, long bytes, FILE *fp);
! 133: EXPORT32 long SMBCALL smb_fgetlength(FILE *fp);
! 134: EXPORT32 int SMBCALL smb_fsetlength(FILE *fp, long length);
! 135: EXPORT32 void SMBCALL smb_rewind(FILE *fp);
! 136: EXPORT32 void SMBCALL smb_clearerr(FILE *fp);
1.1 root 137:
1.1.1.2 ! root 138: #ifdef __cplusplus
! 139: }
! 140: #endif
1.1 root 141:
142: #ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */
143: #pragma aux smb_ver "_*"
144: #pragma aux smb_lib_ver "_*"
145: #pragma aux smb_open "_*"
146: #pragma aux smb_close "_*"
147: #pragma aux smb_open_da "_*"
148: #pragma aux smb_close_da "_*"
149: #pragma aux smb_open_ha "_*"
150: #pragma aux smb_close_ha "_*"
151: #pragma aux smb_create "_*"
152: #pragma aux smb_stack "_*"
153: #pragma aux smb_trunchdr "_*"
154: #pragma aux smb_locksmbhdr "_*"
155: #pragma aux smb_getstatus "_*"
156: #pragma aux smb_putstatus "_*"
157: #pragma aux smb_unlocksmbhdr "_*"
158: #pragma aux smb_getmsgidx "_*"
159: #pragma aux smb_getlastidx "_*"
160: #pragma aux smb_getmsghdrlen "_*"
161: #pragma aux smb_getmsgdatlen "_*"
162: #pragma aux smb_lockmsghdr "_*"
163: #pragma aux smb_getmsghdr "_*"
164: #pragma aux smb_unlockmsghdr "_*"
165: #pragma aux smb_addcrc "_*"
166: #pragma aux smb_hfield "_*"
167: #pragma aux smb_dfield "_*"
168: #pragma aux smb_addmsghdr "_*"
169: #pragma aux smb_putmsg "_*"
170: #pragma aux smb_putmsgidx "_*"
171: #pragma aux smb_putmsghdr "_*"
172: #pragma aux smb_freemsgmem "_*"
173: #pragma aux smb_hdrblocks "_*"
174: #pragma aux smb_datblocks "_*"
175: #pragma aux smb_allochdr "_*"
176: #pragma aux smb_fallochdr "_*"
177: #pragma aux smb_hallochdr "_*"
178: #pragma aux smb_allocdat "_*"
179: #pragma aux smb_fallocdat "_*"
180: #pragma aux smb_hallocdat "_*"
181: #pragma aux smb_incdat "_*"
182: #pragma aux smb_freemsg "_*"
183: #pragma aux smb_freemsgdat "_*"
184: #pragma aux smb_freemsghdr "_*"
185: #pragma aux smb_getmsgtxt "_*"
186: #pragma aux smb_freemsgtxt "_*"
187: #pragma aux smb_feof "_*"
188: #pragma aux smb_ferror "_*"
189: #pragma aux smb_fflush "_*"
190: #pragma aux smb_fgetc "_*"
191: #pragma aux smb_fputc "_*"
192: #pragma aux smb_fseek "_*"
193: #pragma aux smb_ftell "_*"
194: #pragma aux smb_fread "_*"
195: #pragma aux smb_fwrite "_*"
196: #pragma aux smb_fgetlength "_*"
197: #pragma aux smb_fsetlength "_*"
198: #pragma aux smb_rewind "_*"
199: #pragma aux smb_clearerr "_*"
200: #pragma aux lzh_encode "_*"
201: #pragma aux lzh_decode "_*"
202: #endif /* Watcom */
203:
204:
205: #endif /* Don't add anything after this #endif statement */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.