Mike McCormack | fc93261 | 2002-03-12 19:24:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2002 Mike McCormack |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2.1 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | */ |
| 18 | |
| 19 | #ifndef __INC_SMB__ |
| 20 | #define __INC_SMB__ |
| 21 | |
| 22 | #define NBR_ADDWORD(p,word) { (p)[1] = (word & 0xff); (p)[0] = ((word)>>8)&0xff; } |
| 23 | #define NBR_GETWORD(p) ( (((p)[0])<<8) | ((p)[1]) ) |
| 24 | |
| 25 | #define SMB_ADDWORD(p,word) { (p)[0] = (word & 0xff); (p)[1] = ((word)>>8)&0xff; } |
| 26 | #define SMB_GETWORD(p) ( (((p)[1])<<8) | ((p)[0]) ) |
| 27 | #define SMB_ADDDWORD(p,w) { (p)[3]=((w)>>24)&0xff; (p)[2]=((w)>>16)&0xff; (p)[1]=((w)>>8)&0xff; (p)[0]=(w)&0xff; } |
Mike McCormack | 963985b | 2002-07-19 03:17:19 +0000 | [diff] [blame] | 28 | #define SMB_GETDWORD(p) ( (((p)[3])<<24) | (((p)[2])<<16) | (((p)[1])<<8) | ((p)[0]) ) |
Mike McCormack | fc93261 | 2002-03-12 19:24:04 +0000 | [diff] [blame] | 29 | |
| 30 | #define SMB_COM_CREATE_DIRECTORY 0x00 |
| 31 | #define SMB_COM_DELETE_DIRECTORY 0x01 |
| 32 | #define SMB_COM_OPEN 0x02 |
| 33 | #define SMB_COM_CREATE 0x03 |
| 34 | #define SMB_COM_CLOSE 0x04 |
| 35 | #define SMB_COM_FLUSH 0x05 |
| 36 | #define SMB_COM_DELETE 0x06 |
| 37 | #define SMB_COM_RENAME 0x07 |
| 38 | #define SMB_COM_QUERY_INFORMATION 0x08 |
| 39 | #define SMB_COM_SET_INFORMATION 0x09 |
| 40 | #define SMB_COM_READ 0x0A |
| 41 | #define SMB_COM_WRITE 0x0B |
| 42 | #define SMB_COM_LOCK_BYTE_RANGE 0x0C |
| 43 | #define SMB_COM_UNLOCK_BYTE_RANGE 0x0D |
| 44 | #define SMB_COM_CREATE_TEMPORARY 0x0E |
| 45 | #define SMB_COM_CREATE_NEW 0x0F |
| 46 | #define SMB_COM_CHECK_DIRECTORY 0x10 |
| 47 | #define SMB_COM_PROCESS_EXIT 0x11 |
| 48 | #define SMB_COM_SEEK 0x12 |
| 49 | #define SMB_COM_LOCK_AND_READ 0x13 |
| 50 | #define SMB_COM_WRITE_AND_UNLOCK 0x14 |
| 51 | #define SMB_COM_READ_RAW 0x1A |
| 52 | #define SMB_COM_READ_MPX 0x1B |
| 53 | #define SMB_COM_READ_MPX_SECONDARY 0x1C |
| 54 | #define SMB_COM_WRITE_RAW 0x1D |
| 55 | #define SMB_COM_WRITE_MPX 0x1E |
| 56 | #define SMB_COM_WRITE_COMPLETE 0x20 |
| 57 | #define SMB_COM_SET_INFORMATION2 0x22 |
| 58 | #define SMB_COM_QUERY_INFORMATION2 0x23 |
| 59 | #define SMB_COM_LOCKING_ANDX 0x24 |
| 60 | #define SMB_COM_TRANSACTION 0x25 |
| 61 | #define SMB_COM_TRANSACTION_SECONDARY 0x26 |
| 62 | #define SMB_COM_IOCTL 0x27 |
| 63 | #define SMB_COM_IOCTL_SECONDARY 0x28 |
| 64 | #define SMB_COM_COPY 0x29 |
| 65 | #define SMB_COM_MOVE 0x2A |
| 66 | #define SMB_COM_ECHO 0x2B |
| 67 | #define SMB_COM_WRITE_AND_CLOSE 0x2C |
| 68 | #define SMB_COM_OPEN_ANDX 0x2D |
| 69 | #define SMB_COM_READ_ANDX 0x2E |
| 70 | #define SMB_COM_WRITE_ANDX 0x2F |
| 71 | #define SMB_COM_CLOSE_AND_TREE_DISC 0x31 |
| 72 | #define SMB_COM_TRANSACTION2 0x32 |
| 73 | #define SMB_COM_TRANSACTION2_SECONDARY 0x33 |
| 74 | #define SMB_COM_FIND_CLOSE2 0x34 |
| 75 | #define SMB_COM_FIND_NOTIFY_CLOSE 0x35 |
| 76 | #define SMB_COM_TREE_CONNECT 0x70 |
| 77 | #define SMB_COM_TREE_DISCONNECT 0x71 |
| 78 | #define SMB_COM_NEGOTIATE 0x72 |
| 79 | #define SMB_COM_SESSION_SETUP_ANDX 0x73 |
| 80 | #define SMB_COM_LOGOFF_ANDX 0x74 |
| 81 | #define SMB_COM_TREE_CONNECT_ANDX 0x75 |
| 82 | #define SMB_COM_QUERY_INFORMATION_DISK 0x80 |
| 83 | #define SMB_COM_SEARCH 0x81 |
| 84 | #define SMB_COM_FIND 0x82 |
| 85 | #define SMB_COM_FIND_UNIQUE 0x83 |
| 86 | #define SMB_COM_NT_TRANSACT 0xA0 |
| 87 | #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 |
| 88 | #define SMB_COM_NT_CREATE_ANDX 0xA2 |
| 89 | #define SMB_COM_NT_CANCEL 0xA4 |
| 90 | #define SMB_COM_OPEN_PRINT_FILE 0xC0 |
| 91 | #define SMB_COM_WRITE_PRINT_FILE 0xC1 |
| 92 | #define SMB_COM_CLOSE_PRINT_FILE 0xC2 |
| 93 | #define SMB_COM_GET_PRINT_QUEUE 0xC3 |
| 94 | |
Mike McCormack | 963985b | 2002-07-19 03:17:19 +0000 | [diff] [blame] | 95 | #define TRANS2_FIND_FIRST2 0x01 |
| 96 | #define TRANS2_FIND_NEXT2 0x02 |
| 97 | |
Patrik Stridvall | f89d4a8 | 2002-03-23 21:39:05 +0000 | [diff] [blame] | 98 | extern BOOL WINAPI SMB_ReadFile(HANDLE hFile, LPVOID buffer, DWORD bytesToRead, LPDWORD bytesRead, LPOVERLAPPED lpOverlapped); |
Dmitry Timoshkov | d75aed2 | 2002-08-27 01:13:58 +0000 | [diff] [blame] | 99 | extern HANDLE WINAPI SMB_CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing, |
Mike McCormack | fc93261 | 2002-03-12 19:24:04 +0000 | [diff] [blame] | 100 | LPSECURITY_ATTRIBUTES sa, DWORD creation, |
| 101 | DWORD attributes, HANDLE template ); |
| 102 | |
Mike McCormack | 963985b | 2002-07-19 03:17:19 +0000 | [diff] [blame] | 103 | typedef struct tagSMB_DIR |
| 104 | { |
| 105 | int current; |
| 106 | int num_entries; |
| 107 | unsigned char **entries; |
| 108 | unsigned char *buffer; |
| 109 | } SMB_DIR; |
Mike McCormack | fc93261 | 2002-03-12 19:24:04 +0000 | [diff] [blame] | 110 | |
Dmitry Timoshkov | d75aed2 | 2002-08-27 01:13:58 +0000 | [diff] [blame] | 111 | extern SMB_DIR* WINAPI SMB_FindFirst(LPCWSTR filename); |
| 112 | extern BOOL WINAPI SMB_FindNext(SMB_DIR *dir, WIN32_FIND_DATAW *data ); |
Mike McCormack | 963985b | 2002-07-19 03:17:19 +0000 | [diff] [blame] | 113 | extern BOOL WINAPI SMB_CloseDir(SMB_DIR *dir); |
| 114 | |
| 115 | #endif /* __INC_SMB__ */ |