Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2f4f2908
Commit
2f4f2908
authored
Oct 08, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed dependency on ntdll_misc.h.
parent
953849f2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
39 deletions
+38
-39
smb.c
files/smb.c
+38
-39
No files found.
files/smb.c
View file @
2f4f2908
...
...
@@ -112,7 +112,6 @@
#include "smb.h"
#include "winternl.h"
#include "ntdll_misc.h"
#include "wine/server.h"
#include "wine/debug.h"
...
...
@@ -466,7 +465,7 @@ static BOOL NB_RecvData(int fd, struct NB_Buffer *rx)
rx
->
len
=
NBR_GETWORD
(
&
buffer
[
2
]);
rx
->
buffer
=
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
->
len
);
rx
->
buffer
=
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
rx
->
len
);
if
(
!
rx
->
buffer
)
return
FALSE
;
...
...
@@ -474,7 +473,7 @@ static BOOL NB_RecvData(int fd, struct NB_Buffer *rx)
if
(
rx
->
len
!=
r
)
{
TRACE
(
"Received %d bytes
\n
"
,
r
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
->
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
->
buffer
);
rx
->
buffer
=
0
;
rx
->
len
=
0
;
return
FALSE
;
...
...
@@ -643,11 +642,11 @@ static BOOL SMB_NegotiateProtocol(int fd, USHORT *dialect)
if
(
SMB_GetError
(
rx
.
buffer
))
{
ERR
(
"returned error
\n
"
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
return
FALSE
;
}
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
*
dialect
=
0
;
...
...
@@ -745,11 +744,11 @@ static BOOL SMB_SessionSetup(int fd, USHORT *userid)
*
userid
=
SMB_GETWORD
(
&
rx
.
buffer
[
SMB_USERID
]);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
return
TRUE
;
done:
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
return
FALSE
;
}
...
...
@@ -803,13 +802,13 @@ static BOOL SMB_TreeConnect(int fd, USHORT user_id, LPCSTR share_name, USHORT *t
if
(
SMB_GetError
(
rx
.
buffer
))
{
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
return
FALSE
;
}
*
treeid
=
SMB_GETWORD
(
&
rx
.
buffer
[
SMB_TREEID
]);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
TRACE
(
"OK, treeid = %04x
\n
"
,
*
treeid
);
return
TRUE
;
...
...
@@ -1042,7 +1041,7 @@ static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
user_id
,
tree_id
,
file_id
,
count
,
offset
);
buf_size
=
count
+
0x100
;
tx
.
buffer
=
(
unsigned
char
*
)
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
buf_size
);
tx
.
buffer
=
(
unsigned
char
*
)
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
buf_size
);
memset
(
tx
.
buffer
,
0
,
buf_size
);
...
...
@@ -1060,14 +1059,14 @@ static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
rx
.
len
=
0
;
if
(
!
NB_Transaction
(
fd
,
&
tx
,
&
rx
))
{
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
tx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
tx
.
buffer
);
return
FALSE
;
}
if
(
SMB_GetError
(
rx
.
buffer
))
{
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
tx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
tx
.
buffer
);
return
FALSE
;
}
...
...
@@ -1075,8 +1074,8 @@ static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
if
(
(
SMB_HDRSIZE
+
n
*
2
)
>
rx
.
len
)
{
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
tx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
tx
.
buffer
);
ERR
(
"Bad parameter count %d
\n
"
,
n
);
return
FALSE
;
}
...
...
@@ -1095,8 +1094,8 @@ static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
TRACE
(
"Read %d bytes
\n
"
,
n
);
*
read
=
n
;
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
tx
.
buffer
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
rx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
tx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
rx
.
buffer
);
return
TRUE
;
}
...
...
@@ -1138,7 +1137,7 @@ static BOOL SMB_Transaction2(int fd, int tree_id, int user_id,
BOOL
ret
=
FALSE
;
buf_size
=
0x100
+
send
->
setup_count
*
2
+
send
->
param_count
+
send
->
data_count
;
tx
.
buffer
=
(
unsigned
char
*
)
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
buf_size
);
tx
.
buffer
=
(
unsigned
char
*
)
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
buf_size
);
tx
.
len
=
SMB_Header
(
tx
.
buffer
,
SMB_COM_TRANSACTION2
,
tree_id
,
user_id
);
...
...
@@ -1240,7 +1239,7 @@ static BOOL SMB_Transaction2(int fd, int tree_id, int user_id,
done:
if
(
tx
.
buffer
)
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
tx
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
tx
.
buffer
);
return
ret
;
}
...
...
@@ -1257,15 +1256,15 @@ static BOOL SMB_SetupFindFirst(struct SMB_Trans2Info *send, LPSTR filename)
memset
(
send
,
0
,
sizeof
(
send
));
send
->
setup_count
=
1
;
send
->
setup
=
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
send
->
setup_count
*
2
);
send
->
setup
=
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
send
->
setup_count
*
2
);
if
(
!
send
->
setup
)
return
FALSE
;
buf_size
=
0x10
+
strlen
(
filename
);
send
->
params
=
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
buf_size
);
send
->
params
=
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
buf_size
);
if
(
!
send
->
params
)
{
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
send
->
setup
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
send
->
setup
);
return
FALSE
;
}
...
...
@@ -1306,8 +1305,8 @@ static SMB_DIR *SMB_Trans2FindFirst(int fd, USHORT tree_id,
memset
(
&
recv
,
0
,
sizeof
(
recv
));
ret
=
SMB_Transaction2
(
fd
,
tree_id
,
user_id
,
&
send
,
&
recv
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
send
.
params
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
send
.
setup
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
send
.
params
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
send
.
setup
);
if
(
!
ret
)
goto
done
;
...
...
@@ -1324,14 +1323,14 @@ static SMB_DIR *SMB_Trans2FindFirst(int fd, USHORT tree_id,
if
(
SMB_GETWORD
(
&
recv
.
params
[
4
]))
FIXME
(
"need to read more!
\n
"
);
smbdir
=
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
sizeof
(
*
smbdir
));
smbdir
=
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
sizeof
(
*
smbdir
));
if
(
smbdir
)
{
int
i
,
ofs
=
0
;
smbdir
->
current
=
0
;
smbdir
->
num_entries
=
num
;
smbdir
->
entries
=
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
sizeof
(
unsigned
char
*
)
*
num
);
smbdir
->
entries
=
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
sizeof
(
unsigned
char
*
)
*
num
);
if
(
!
smbdir
->
entries
)
goto
done
;
smbdir
->
buffer
=
recv
.
buf
.
buffer
;
/* save to free later */
...
...
@@ -1361,12 +1360,12 @@ done:
if
(
!
ret
)
{
if
(
recv
.
buf
.
buffer
)
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
recv
.
buf
.
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
recv
.
buf
.
buffer
);
if
(
smbdir
)
{
if
(
smbdir
->
entries
)
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
smbdir
->
entries
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
smbdir
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
smbdir
->
entries
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
smbdir
);
}
smbdir
=
NULL
;
}
...
...
@@ -1433,14 +1432,14 @@ static BOOL SMB_LoginAndConnect(int fd, LPCSTR host, LPCSTR share, USHORT *tree_
if
(
!
SMB_SessionSetup
(
fd
,
user_id
))
return
FALSE
;
name
=
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
strlen
(
host
)
+
strlen
(
share
)
+
5
);
name
=
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
strlen
(
host
)
+
strlen
(
share
)
+
5
);
if
(
!
name
)
return
FALSE
;
sprintf
(
name
,
"
\\\\
%s
\\
%s"
,
host
,
share
);
if
(
!
SMB_TreeConnect
(
fd
,
*
user_id
,
name
,
tree_id
))
{
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
name
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
name
);
return
FALSE
;
}
...
...
@@ -1486,7 +1485,7 @@ HANDLE WINAPI SMB_CreateFileW( LPCWSTR uncname, DWORD access, DWORD sharing,
INT
len
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
uncname
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
name
=
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
len
);
name
=
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
len
);
if
(
!
name
)
return
handle
;
...
...
@@ -1494,7 +1493,7 @@ HANDLE WINAPI SMB_CreateFileW( LPCWSTR uncname, DWORD access, DWORD sharing,
if
(
!
UNC_SplitName
(
name
,
&
host
,
&
share
,
&
file
)
)
{
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
name
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
name
);
return
handle
;
}
...
...
@@ -1532,7 +1531,7 @@ HANDLE WINAPI SMB_CreateFileW( LPCWSTR uncname, DWORD access, DWORD sharing,
}
done:
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
name
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
name
);
return
handle
;
}
...
...
@@ -1633,7 +1632,7 @@ SMB_DIR* WINAPI SMB_FindFirst(LPCWSTR name)
TRACE
(
"Find %s
\n
"
,
debugstr_w
(
name
));
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
name
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
filename
=
RtlAllocateHeap
(
ntdll_get_process_h
eap
(),
0
,
len
);
filename
=
RtlAllocateHeap
(
GetProcessH
eap
(),
0
,
len
);
if
(
!
filename
)
return
ret
;
WideCharToMultiByte
(
CP_ACP
,
0
,
name
,
-
1
,
filename
,
len
,
NULL
,
NULL
);
...
...
@@ -1658,7 +1657,7 @@ done:
close
(
fd
);
if
(
filename
)
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
filename
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
filename
);
return
ret
;
}
...
...
@@ -1708,9 +1707,9 @@ BOOL WINAPI SMB_FindNext(SMB_DIR *dir, WIN32_FIND_DATAW *data )
BOOL
WINAPI
SMB_CloseDir
(
SMB_DIR
*
dir
)
{
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
dir
->
buffer
);
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
dir
->
entries
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
dir
->
buffer
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
dir
->
entries
);
memset
(
dir
,
0
,
sizeof
(
*
dir
));
RtlFreeHeap
(
ntdll_get_process_h
eap
(),
0
,
dir
);
RtlFreeHeap
(
GetProcessH
eap
(),
0
,
dir
);
return
TRUE
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment