Commit 2f4f2908 authored by Alexandre Julliard's avatar Alexandre Julliard

Removed dependency on ntdll_misc.h.

parent 953849f2
......@@ -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_heap(), 0, rx->len);
rx->buffer = RtlAllocateHeap(GetProcessHeap(), 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_heap(), 0, rx->buffer);
RtlFreeHeap(GetProcessHeap(), 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_heap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),0,rx.buffer);
return FALSE;
}
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),0,rx.buffer);
return TRUE;
done:
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),0,rx.buffer);
return FALSE;
}
*treeid = SMB_GETWORD(&rx.buffer[SMB_TREEID]);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,buf_size);
tx.buffer = (unsigned char *) RtlAllocateHeap(GetProcessHeap(),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_heap(),0,tx.buffer);
RtlFreeHeap(GetProcessHeap(),0,tx.buffer);
return FALSE;
}
if(SMB_GetError(rx.buffer))
{
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,tx.buffer);
RtlFreeHeap(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,tx.buffer);
RtlFreeHeap(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,tx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
RtlFreeHeap(GetProcessHeap(),0,tx.buffer);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,buf_size);
tx.buffer = (unsigned char *) RtlAllocateHeap(GetProcessHeap(),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_heap(),0,tx.buffer);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,send->setup_count*2);
send->setup = RtlAllocateHeap(GetProcessHeap(),0,send->setup_count*2);
if(!send->setup)
return FALSE;
buf_size = 0x10 + strlen(filename);
send->params = RtlAllocateHeap(ntdll_get_process_heap(),0,buf_size);
send->params = RtlAllocateHeap(GetProcessHeap(),0,buf_size);
if(!send->params)
{
RtlFreeHeap(ntdll_get_process_heap(),0,send->setup);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,send.params);
RtlFreeHeap(ntdll_get_process_heap(),0,send.setup);
RtlFreeHeap(GetProcessHeap(),0,send.params);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,sizeof(*smbdir));
smbdir = RtlAllocateHeap(GetProcessHeap(),0,sizeof(*smbdir));
if(smbdir)
{
int i, ofs=0;
smbdir->current = 0;
smbdir->num_entries = num;
smbdir->entries = RtlAllocateHeap(ntdll_get_process_heap(), 0, sizeof(unsigned char*)*num);
smbdir->entries = RtlAllocateHeap(GetProcessHeap(), 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_heap(),0,recv.buf.buffer);
RtlFreeHeap(GetProcessHeap(),0,recv.buf.buffer);
if( smbdir )
{
if( smbdir->entries )
RtlFreeHeap(ntdll_get_process_heap(),0,smbdir->entries);
RtlFreeHeap(ntdll_get_process_heap(),0,smbdir);
RtlFreeHeap(GetProcessHeap(),0,smbdir->entries);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,strlen(host)+strlen(share)+5);
name = RtlAllocateHeap(GetProcessHeap(),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_heap(),0,name);
RtlFreeHeap(GetProcessHeap(),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_heap(), 0, len);
name = RtlAllocateHeap(GetProcessHeap(), 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_heap(),0,name);
RtlFreeHeap(GetProcessHeap(),0,name);
return handle;
}
......@@ -1532,7 +1531,7 @@ HANDLE WINAPI SMB_CreateFileW( LPCWSTR uncname, DWORD access, DWORD sharing,
}
done:
RtlFreeHeap(ntdll_get_process_heap(),0,name);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,len);
filename = RtlAllocateHeap(GetProcessHeap(),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_heap(),0,filename);
RtlFreeHeap(GetProcessHeap(),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_heap(),0,dir->buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,dir->entries);
RtlFreeHeap(GetProcessHeap(),0,dir->buffer);
RtlFreeHeap(GetProcessHeap(),0,dir->entries);
memset(dir,0,sizeof(*dir));
RtlFreeHeap(ntdll_get_process_heap(),0,dir);
RtlFreeHeap(GetProcessHeap(),0,dir);
return TRUE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment