Finished separation of shell32 and wsock32.

This commit is contained in:
Alexandre Julliard 2000-12-01 20:48:41 +00:00
parent 1ec253d205
commit 3a0f8b7953
16 changed files with 208 additions and 99 deletions

View File

@ -945,9 +945,12 @@ debug_channels (comm debugstr dll int resource stress thunk toolhelp win32)
@ stdcall FindResource16(long str str) FindResource16
@ stdcall FreeResource16(long) FreeResource16
@ stdcall GetCurrentTask() GetCurrentTask
@ stdcall GetDOSEnvironment16() GetDOSEnvironment16
@ stdcall GetModuleFileName16(long ptr long) GetModuleFileName16
@ stdcall GetModuleHandle16(str) GetModuleHandle16
@ stdcall LoadResource16(long long) LoadResource16
@ stdcall LockResource16(long) LockResource16
@ stdcall WinExec16(str long) WinExec16
################################################################
# Wine internal extensions
@ -965,3 +968,6 @@ debug_channels (comm debugstr dll int resource stress thunk toolhelp win32)
@ stdcall wine_call_to_16_long(ptr long) wine_call_to_16_long
@ stdcall wine_call_to_16_regs_short(ptr long) wine_call_to_16_regs_short
@ stdcall wine_call_to_16_regs_long (ptr long) wine_call_to_16_regs_long
# Unix files
@ stdcall wine_get_unix_file_name(str ptr long) wine_get_unix_file_name

View File

@ -5,7 +5,6 @@ VPATH = @srcdir@
MODULE = shell32
ALTNAMES = shell
EXTRALIBS = -lwine_unicode
IMPORTS = user32 gdi32 kernel32 ntdll
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o

View File

@ -785,7 +785,7 @@ LRESULT WINAPI ShellHookProc16(INT16 code, WPARAM16 wParam, LPARAM lParam)
case HSHELL_WINDOWDESTROYED: uMsg = uMsgWndDestroyed; break;
case HSHELL_ACTIVATESHELLWINDOW: uMsg = uMsgShellActivate;
}
PostMessage16( SHELL_hWnd, uMsg, wParam, 0 );
PostMessageA( SHELL_hWnd, uMsg, wParam, 0 );
}
return CallNextHookEx16( WH_SHELL, code, wParam, lParam );
}
@ -825,3 +825,25 @@ BOOL WINAPI RegisterShellHook16(HWND16 hWnd, UINT16 uAction)
}
return FALSE;
}
/***********************************************************************
* DriveType16 (SHELL.262)
*/
UINT16 WINAPI DriveType16( UINT16 drive )
{
UINT ret;
char path[] = "A:\\";
path[0] += drive;
ret = GetDriveTypeA(path);
switch(ret) /* some values are not supported in Win16 */
{
case DRIVE_CDROM:
ret = DRIVE_REMOTE;
break;
case DRIVE_DOESNOTEXIST:
ret = DRIVE_CANNOTDETERMINE;
break;
}
return ret;
}

View File

@ -36,7 +36,7 @@ owner shell32
157 stub RESTARTDIALOG
# 166 PICKICONDLG
262 pascal16 DriveType(long) GetDriveType16
262 pascal16 DriveType(long) DriveType16
# 263 SH16TO32DRIVEIOCTL
# 264 SH16TO32INT2526

View File

@ -8,11 +8,11 @@ import ole32.dll
import shlwapi.dll
import comctl32.dll
#import user32.dll
#import gdi32.dll
#import advapi32.dll
#import kernel32.dll
#import ntdll.dll
import user32.dll
import gdi32.dll
import advapi32.dll
import kernel32.dll
import ntdll.dll
debug_channels (exec pidl shell)

View File

@ -646,6 +646,7 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
}
break;
#if 0 /* FIXME: should use DoDragDrop */
case WM_LBTRACKPOINT:
hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
if( (INT16)GetKeyState( VK_CONTROL ) < 0 )
@ -670,6 +671,7 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
}
}
break;
#endif
case WM_QUERYDROPOBJECT:
if( wParam == 0 )

View File

@ -19,6 +19,7 @@
#include "winerror.h"
#include "winbase.h"
#include "winnls.h"
#include "winreg.h"
#include "shlobj.h"
#include "wine/undocshell.h"
@ -28,8 +29,6 @@
#include "pidl.h"
#include "shell32_main.h"
#include "shlguid.h"
#include "file.h"
#include "options.h"
DEFAULT_DEBUG_CHANNEL(shell);
@ -450,10 +449,10 @@ static int ExtractFromICO(const char *szFileName, const char *szXPMFileName)
/* get the Unix file name for a given path, allocating the string */
inline static char *get_unix_file_name( const char *dos )
{
DOS_FULL_NAME path;
char buffer[MAX_PATH];
if (!DOSFS_GetFullName( dos, FALSE, &path )) return NULL;
return HEAP_strdupA( GetProcessHeap(), 0, path.long_name );
if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL;
return HEAP_strdupA( GetProcessHeap(), 0, buffer );
}
static BOOL create_default_icon( const char *filename )
@ -493,6 +492,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
char *path_name = NULL;
char *work_dir = NULL;
BOOL bDesktop;
HKEY hkey;
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
@ -507,7 +507,14 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
if (strcasecmp( p, ".exe" )) return NOERROR;
/* check if ShellLinker configured */
PROFILE_GetWineIniString( "wine", "ShellLinker", "", buffer, sizeof(buffer) );
buffer[0] = 0;
if (!RegOpenKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine",
0, KEY_ALL_ACCESS, &hkey ))
{
DWORD type, count = sizeof(buffer);
if (RegQueryValueExA( hkey, "ShellLinker", 0, &type, buffer, &count )) buffer[0] = 0;
RegCloseKey( hkey );
}
if (!*buffer) return NOERROR;
shell_link_app = HEAP_strdupA( GetProcessHeap(), 0, buffer );

View File

@ -7,7 +7,6 @@
#include "winreg.h"
#include "debugtools.h"
#include "winnls.h"
#include "heap.h"
#include "shellapi.h"
#include "shlobj.h"
@ -126,3 +125,86 @@ HRESULT WINAPI SHRegCloseKey (HKEY hkey)
TRACE("0x%04x\n",hkey);
return RegCloseKey( hkey );
}
/* 16-bit functions */
/* 0 and 1 are valid rootkeys in win16 shell.dll and are used by
* some programs. Do not remove those cases. -MM
*/
static inline void fix_win16_hkey( HKEY *hkey )
{
if (*hkey == 0 || *hkey == 1) *hkey = HKEY_CLASSES_ROOT;
}
/******************************************************************************
* RegOpenKey16 [SHELL.1]
*/
DWORD WINAPI RegOpenKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
{
fix_win16_hkey( &hkey );
return RegOpenKeyA( hkey, name, retkey );
}
/******************************************************************************
* RegCreateKey16 [SHELL.2]
*/
DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
{
fix_win16_hkey( &hkey );
return RegCreateKeyA( hkey, name, retkey );
}
/******************************************************************************
* RegCloseKey16 [SHELL.3]
*/
DWORD WINAPI RegCloseKey16( HKEY hkey )
{
fix_win16_hkey( &hkey );
return RegCloseKey( hkey );
}
/******************************************************************************
* RegDeleteKey16 [SHELL.4]
*/
DWORD WINAPI RegDeleteKey16( HKEY hkey, LPCSTR name )
{
fix_win16_hkey( &hkey );
return RegDeleteKeyA( hkey, name );
}
/******************************************************************************
* RegSetValue16 [SHELL.5]
*/
DWORD WINAPI RegSetValue16( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWORD count )
{
fix_win16_hkey( &hkey );
return RegSetValueA( hkey, name, type, data, count );
}
/******************************************************************************
* RegQueryValue16 [SHELL.6]
*
* NOTES
* Is this HACK still applicable?
*
* HACK
* The 16bit RegQueryValue doesn't handle selectorblocks anyway, so we just
* mask out the high 16 bit. This (not so much incidently) hopefully fixes
* Aldus FH4)
*/
DWORD WINAPI RegQueryValue16( HKEY hkey, LPCSTR name, LPSTR data, LPDWORD count )
{
fix_win16_hkey( &hkey );
if (count) *count &= 0xffff;
return RegQueryValueA( hkey, name, data, count );
}
/******************************************************************************
* RegEnumKey16 [SHELL.7]
*/
DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
{
fix_win16_hkey( &hkey );
return RegEnumKeyA( hkey, index, name, name_len );
}

View File

@ -656,9 +656,11 @@ debug_channels (accel caret class clipboard combo cursor dc ddeml dialog driver
################################################################
# Wine extensions: Win16 functions that are needed by other dlls
#
@ stdcall CallNextHookEx16(long long long long) CallNextHookEx16
@ stdcall CallWindowProc16(long long long long long) CallWindowProc16
@ stdcall CreateDialogIndirectParam16(long ptr long long long) CreateDialogIndirectParam16
@ stdcall DialogBoxIndirectParam16(long long long long long) DialogBoxIndirectParam16
@ stdcall SetWindowsHookEx16(long long long long) SetWindowsHookEx16
################################################################
# Wine extensions: extra useful functions not exported under Windows

View File

@ -146,9 +146,6 @@ typedef struct /* WSAAsyncSelect() control struct */
typedef struct _WSINFO
{
DWORD dwThisProcess;
struct _WSINFO *lpNextIData;
unsigned flags;
INT16 num_startup; /* reference counter */
INT16 num_async_rq;
@ -326,44 +323,16 @@ static int _get_sock_error(SOCKET s, unsigned int bit)
return ret;
}
static LPWSINFO lpFirstIData = NULL;
static WSINFO wsinfo;
static LPWSINFO WINSOCK_GetIData(void)
inline static LPWSINFO WINSOCK_GetIData(void)
{
DWORD pid = GetCurrentProcessId();
LPWSINFO iData;
for (iData = lpFirstIData; iData; iData = iData->lpNextIData) {
if (iData->dwThisProcess == pid)
break;
}
return iData;
}
static BOOL WINSOCK_CreateIData(void)
{
LPWSINFO iData;
iData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WSINFO));
if (!iData)
return FALSE;
iData->dwThisProcess = GetCurrentProcessId();
iData->lpNextIData = lpFirstIData;
lpFirstIData = iData;
return TRUE;
return &wsinfo;
}
static void WINSOCK_DeleteIData(void)
{
LPWSINFO iData = WINSOCK_GetIData();
LPWSINFO* ppid;
if (iData) {
for (ppid = &lpFirstIData; *ppid; ppid = &(*ppid)->lpNextIData) {
if (*ppid == iData) {
*ppid = iData->lpNextIData;
break;
}
}
if( iData->flags & WSI_BLOCKINGCALL )
TRACE("\tinside blocking call!\n");
@ -374,7 +343,6 @@ static void WINSOCK_DeleteIData(void)
if( iData->dbuffer ) SEGPTR_FREE(iData->dbuffer);
HeapFree(GetProcessHeap(), 0, iData);
}
}
/***********************************************************************
@ -391,21 +359,6 @@ BOOL WINAPI WSOCK32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad
return TRUE;
}
/***********************************************************************
* WINSOCK_LibMain (WINSOCK.init)
*/
BOOL WINAPI WINSOCK_LibMain(DWORD fdwReason, HINSTANCE hInstDLL, WORD ds,
WORD wHeapSize, DWORD dwReserved1, WORD wReserved2)
{
TRACE("0x%x 0x%lx\n", hInstDLL, fdwReason);
switch (fdwReason) {
case DLL_PROCESS_DETACH:
WINSOCK_DeleteIData();
break;
}
return TRUE;
}
/***********************************************************************
* convert_sockopt()
*
@ -650,12 +603,6 @@ INT16 WINAPI WSAStartup16(UINT16 wVersionRequested, LPWSADATA lpWSAData)
if( _WSHeap == 0 ) return WSASYSNOTREADY;
pwsi = WINSOCK_GetIData();
if( pwsi == NULL )
{
WINSOCK_CreateIData();
pwsi = WINSOCK_GetIData();
if (!pwsi) return WSASYSNOTREADY;
}
pwsi->num_startup++;
/* return winsock information */
@ -711,12 +658,6 @@ INT WINAPI WSAStartup(UINT wVersionRequested, LPWSADATA lpWSAData)
if( _WSHeap == 0 ) return WSASYSNOTREADY;
pwsi = WINSOCK_GetIData();
if( pwsi == NULL )
{
WINSOCK_CreateIData();
pwsi = WINSOCK_GetIData();
if (!pwsi) return WSASYSNOTREADY;
}
pwsi->num_startup++;
/* return winsock information */
@ -2832,23 +2773,6 @@ INT16 WINAPI WSAAsyncSelect16(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, LONG lEvent)
return (INT16)WSAAsyncSelect( s, hWnd, wMsg, lEvent );
}
/***********************************************************************
* WSARecvEx() (WSOCK32.1107)
*
* WSARecvEx is a Microsoft specific extension to winsock that is identical to recv
* except that has an in/out argument call flags that has the value MSG_PARTIAL ored
* into the flags parameter when a partial packet is read. This only applies to
* sockets using the datagram protocol. This method does not seem to be implemented
* correctly by microsoft as the winsock implementation does not set the MSG_PARTIAL
* flag when a fragmented packet arrives.
*/
INT WINAPI WSARecvEx(SOCKET s, char *buf, INT len, INT *flags) {
FIXME("(WSARecvEx) partial packet return value not set \n");
return WSOCK32_recv(s, buf, len, *flags);
}
/***********************************************************************
* WSARecvEx16() (WINSOCK.1107)
*

View File

@ -61,5 +61,3 @@ owner ws2_32
116 pascal WSACleanup() WSACleanup
151 pascal16 __WSAFDIsSet(word ptr) __WSAFDIsSet16
1107 pascal16 WSARecvEx(word ptr word ptr) WSARecvEx16
1999 pascal DllEntryPoint(long word word word long word) WINSOCK_LibMain

View File

@ -3,8 +3,9 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = wsock32
SOVERSION = 1.0
IMPORTS = ws2_32 kernel32 ntdll
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = socket.c

View File

@ -8,6 +8,7 @@
#include <sys/types.h>
#include "windef.h"
#include "winbase.h"
#include "debugtools.h"
#include "winsock2.h"
#include "winnt.h"
@ -26,6 +27,7 @@
DEFAULT_DEBUG_CHANNEL(winsock);
static INT (WINAPI *WS2_recv)(SOCKET s, char *buf, INT len, INT flags);
/***********************************************************************
* WsControl()
@ -682,6 +684,21 @@ int WSCNTL_GetTransRecvStat(int intNumber, unsigned long *transBytes, unsigned l
}
/***********************************************************************
* WSARecvEx() (WSOCK32.1107)
*
* WSARecvEx is a Microsoft specific extension to winsock that is identical to recv
* except that has an in/out argument call flags that has the value MSG_PARTIAL ored
* into the flags parameter when a partial packet is read. This only applies to
* sockets using the datagram protocol. This method does not seem to be implemented
* correctly by microsoft as the winsock implementation does not set the MSG_PARTIAL
* flag when a fragmented packet arrives.
*/
INT WINAPI WSARecvEx(SOCKET s, char *buf, INT len, INT *flags)
{
FIXME("(WSARecvEx) partial packet return value not set \n");
return WS2_recv(s, buf, len, *flags);
}
/***********************************************************************
@ -692,3 +709,31 @@ void WINAPI WS_s_perror(LPCSTR message)
FIXME("(%s): stub\n",message);
return;
}
/***********************************************************************
* WSOCK_LibMain
*/
BOOL WINAPI WSOCK_LibMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
{
static HMODULE ws2_32;
switch (reason)
{
case DLL_PROCESS_ATTACH:
/* we import ws2_32 by hand, because we don't want to implicitly */
/* link to it; otherwise Unix calls like socket() get redirected */
/* to ws2_32.dll and this is not what we want. */
if (!(ws2_32 = LoadLibraryA( "ws2_32.dll" )))
{
ERR("could not load ws2_32\n" );
return FALSE;
}
WS2_recv = (void *)GetProcAddress( ws2_32, "recv" );
break;
case DLL_PROCESS_DETACH:
FreeLibrary( ws2_32 );
break;
}
return TRUE;
}

View File

@ -1,7 +1,7 @@
name wsock32
type win32
init WSOCK_LibMain
import ws2_32.dll
import kernel32.dll
import ntdll.dll

View File

@ -1366,6 +1366,21 @@ DWORD WINAPI GetFullPathNameW( LPCWSTR name, DWORD len, LPWSTR buffer,
return ret;
}
/***********************************************************************
* wine_get_unix_file_name (Not a Windows API, but exported from KERNEL32)
*
* Return the full Unix file name for a given path.
*/
BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len )
{
BOOL ret;
DOS_FULL_NAME path;
if ((ret = DOSFS_GetFullName( dos, FALSE, &path ))) lstrcpynA( buffer, dos, len );
return ret;
}
/***********************************************************************
* DOSFS_FindNextEx
*/

View File

@ -1894,6 +1894,12 @@ DWORD WINAPI _ConfirmSysLevel(SYSLEVEL*);
VOID WINAPI _EnterSysLevel(SYSLEVEL*);
VOID WINAPI _LeaveSysLevel(SYSLEVEL*);
/* Wine internal functions */
BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len );
/* a few optimizations for i386/gcc */
#if defined(__i386__) && defined(__GNUC__)