Commit 4a0a199f authored by Martin Fuchs's avatar Martin Fuchs Committed by Alexandre Julliard

Implement connecting and disconnecting of network drives.

parent 4776085c
......@@ -64,8 +64,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "Vytvoit syst&mov disk...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "Pipojit sov &disk" , 252
MENUITEM "&Odpojit sov disk" , 253
MENUITEM "Pipojit sov &disk" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Odpojit sov disk" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Sdlet jako..." , 254
MENUITEM "Odst&ranit sdlen..." , 255
......
......@@ -63,8 +63,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "Netzwerklaufwerk &verbinden..." , 252
MENUITEM "Netzwerklaufwerk &trennen..." , 253
MENUITEM "Netzwerklaufwerk &verbinden..." , ID_CONNECT_NETWORK_DRIVE
MENUITEM "Netzwerklaufwerk &trennen..." , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "F&reigeben als..." , 254
MENUITEM "Freigabe been&den..." , 255
......
......@@ -63,8 +63,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Make System Disk...", -1 /*TODO*/
#endif
MENUITEM SEPARATOR
MENUITEM "Connect &Network Drive" , 252
MENUITEM "&Disconnect Network Drive" , 253
MENUITEM "Connect &Network Drive" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Disconnect Network Drive" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Share as..." , 254
MENUITEM "&Remove Share..." , 255
......
......@@ -61,8 +61,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Hacer disco de sistema...", -1 /*TODO*/
#endif
MENUITEM SEPARATOR
MENUITEM "C&onectar unidad de red" , 252
MENUITEM "&Desconectar unidad de red" , 253
MENUITEM "C&onectar unidad de red" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Desconectar unidad de red" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Co&mpartir como..." , 254
MENUITEM "&Eliminar compartido..." , 255
......
......@@ -64,8 +64,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "Crer un disque *systme...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "Connecter un lecteur &rseau" , 252
MENUITEM "&Dconnecter un lecteur rseau" , 253
MENUITEM "Connecter un lecteur &rseau" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Dconnecter un lecteur rseau" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "&Partager..." , 254
MENUITEM "Cesser de parta&ger" , 255
......
......@@ -64,8 +64,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Rendszerlemez ksztse...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "&Hlzati meghajt csatlakoztatsa" , 252
MENUITEM "Hlzati meghajt levlasztsa" , 253
MENUITEM "&Hlzati meghajt csatlakoztatsa" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "Hlzati meghajt levlasztsa" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Megoszts..." , 254
MENUITEM "Megoszts &megszntetse..." , 255
......
......@@ -64,8 +64,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Crea Disco di Sistema...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "Connetti & Drive di Rete" , 252
MENUITEM "&Disconnetti Drive di Rete" , 253
MENUITEM "Connetti & Drive di Rete" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Disconnetti Drive di Rete" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Condividi come..." , 254
MENUITEM "&Rimuovi condivisione..." , 255
......
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = winefile.exe
APPMODE = -mwindows
IMPORTS = shell32 comdlg32 comctl32 ole32 user32 gdi32 kernel32
IMPORTS = shell32 comdlg32 comctl32 ole32 user32 gdi32 kernel32 mpr
EXTRALIBS = -luuid
C_SRCS = \
......
......@@ -60,8 +60,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "Systeemdisk maken...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "Verbinding &maken met netwerkchijf" , 252
MENUITEM "Verbinding &verbreken met netwerkschijf" , 253
MENUITEM "Verbinding &maken met netwerkchijf" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "Verbinding &verbreken met netwerkschijf" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Schijf &delen..." , 254
MENUITEM "Delen &ongedaan maken..." , 255
......
......@@ -64,8 +64,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Stwrz dysk systemowy...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "&Podcz Dysk Sieciowy" , 252
MENUITEM "&Odcz Dysk Sieciowy" , 253
MENUITEM "&Podcz Dysk Sieciowy" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Odcz Dysk Sieciowy" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Udostpnij jako..." , 254
MENUITEM "&Nie udostpniaj..." , 255
......
......@@ -63,8 +63,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Gerar disco de sistema...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "Conecta&r unidade de rede" , 252
MENUITEM "&Desconectar unidade de rede" , 253
MENUITEM "Conecta&r unidade de rede" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Desconectar unidade de rede" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "C&ompartilhar como..." , 254
MENUITEM "&Remover compartilhamento..." , 255
......@@ -190,8 +190,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Gerar disco de sistema...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "Conecta&r unidade de rede" , 252
MENUITEM "&Desconectar unidade de rede" , 253
MENUITEM "Conecta&r unidade de rede" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Desconectar unidade de rede" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "&Partilhar como..." , 254
MENUITEM "&Remover partilha..." , 255
......
......@@ -60,8 +60,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "& ...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "& " , 252
MENUITEM "& " , 253
MENUITEM "& " , ID_CONNECT_NETWORK_DRIVE
MENUITEM "& " , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM " & ..." , 254
MENUITEM "& ..." , 255
......
......@@ -61,8 +61,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Make System Disk...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "Connect &Network Drive" , 252
MENUITEM "&Disconnect Network Drive" , 253
MENUITEM "Connect &Network Drive" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Disconnect Network Drive" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Share as..." , 254
MENUITEM "&Remove Share..." , 255
......
......@@ -59,13 +59,13 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Kopiera disk...", 201
MENUITEM "&Namnge disk...", 202
MENUITEM SEPARATOR
MENUITEM "&Formatera disk...", 203
MENUITEM "&Formatera disk...", ID_FORMAT_DISK
#ifdef _WIN95
MENUITEM "&Skapa systemdisk...", -1 /*TODO*/
#endif
MENUITEM SEPARATOR
MENUITEM "Anslut &Ntverksenhet", 252
MENUITEM "&Koppla ifrn Ntverksenhet", 253
MENUITEM "Anslut &Ntverksenhet", ID_CONNECT_NETWORK_DRIVE
MENUITEM "&Koppla ifrn Ntverksenhet", ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "Dela ut...", 254
MENUITEM "&Ta bort utdelning...", 255
......
......@@ -61,8 +61,8 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "建立系统盘(&M)...", -1 /*@@ */
#endif
MENUITEM SEPARATOR
MENUITEM "连接网络驱动器(&N)" , 252
MENUITEM "断开网络驱动器连接(&D)" , 253
MENUITEM "连接网络驱动器(&N)" , ID_CONNECT_NETWORK_DRIVE
MENUITEM "断开网络驱动器连接(&D)" , ID_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR
MENUITEM "共享为..." , 254
MENUITEM "删除共享(&R)..." , 255
......
......@@ -42,6 +42,8 @@
#define ID_FILE_MOVE 106
#define ID_FILE_EXIT 115
#define ID_FORMAT_DISK 203
#define ID_CONNECT_NETWORK_DRIVE 252
#define ID_DISCONNECT_NETWORK_DRIVE 253
#define ID_VIEW_NAME 401
#define ID_VIEW_ALL_ATTRIBUTES 402
#define ID_VIEW_SELECTED_ATTRIBUTES 403
......
......@@ -170,6 +170,7 @@ extern void WineWarranty(HWND hwnd);
static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd);
static void set_curdir(ChildWnd* child, Entry* entry, int idx, HWND hwnd);
static void refresh_child(ChildWnd* child);
static void refresh_drives();
static void get_path(Entry* dir, PTSTR path);
LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
......@@ -227,6 +228,18 @@ static void display_error(HWND hwnd, DWORD error)
LocalFree(msg);
}
/* display network error message using WNetGetLastError() */
static void display_network_error(HWND hwnd)
{
TCHAR msg[BUFFER_LEN], provider[BUFFER_LEN], b2[BUFFER_LEN];
DWORD error;
if (WNetGetLastError(&error, msg, BUFFER_LEN, provider, BUFFER_LEN) == NO_ERROR)
MessageBox(hwnd, msg, RS(b2,IDS_WINEFILE), MB_OK);
}
/* allocate and initialise a directory entry */
static Entry* alloc_entry()
{
......@@ -1880,6 +1893,10 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
free(child);
break;}
case ID_REFRESH:
refresh_drives();
break;
case ID_WINDOW_CASCADE:
SendMessage(Globals.hmdiclient, WM_MDICASCADE, 0, 0);
break;
......@@ -1970,6 +1987,30 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
}
break;}
case ID_CONNECT_NETWORK_DRIVE: {
DWORD ret = WNetConnectionDialog(hwnd, RESOURCETYPE_DISK);
if (ret == NO_ERROR)
refresh_drives();
else if (ret != (DWORD)-1) {
if (ret == ERROR_EXTENDED_ERROR)
display_network_error(hwnd);
else
display_error(hwnd, ret);
}
break;}
case ID_DISCONNECT_NETWORK_DRIVE: {
DWORD ret = WNetDisconnectDialog(hwnd, RESOURCETYPE_DISK);
if (ret == NO_ERROR)
refresh_drives();
else if (ret != (DWORD)-1) {
if (ret == ERROR_EXTENDED_ERROR)
display_network_error(hwnd);
else
display_error(hwnd, ret);
}
break;}
case ID_FORMAT_DISK: {
UINT sem_org = SetErrorMode(0); /* Get the current Error Mode settings. */
SetErrorMode(sem_org & ~SEM_FAILCRITICALERRORS); /* Force O/S to handle */
......@@ -3289,6 +3330,87 @@ static void refresh_child(ChildWnd* child)
}
static void create_drive_bar()
{
TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0};
TCHAR b1[BUFFER_LEN];
int btn = 1;
PTSTR p;
GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
Globals.hdrivebar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,
IDW_DRIVEBAR, 2, Globals.hInstance, IDB_DRIVEBAR, &drivebarBtn,
1, 16, 13, 16, 13, sizeof(TBBUTTON));
#ifndef _NO_EXTENSIONS
#ifdef __WINE__
/* insert unix file system button */
b1[0] = '/';
b1[1] = '\0';
b1[2] = '\0';
SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1);
drivebarBtn.idCommand = ID_DRIVE_UNIX_FS;
SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
drivebarBtn.iString++;
#endif
#ifdef _SHELL_FOLDERS
/* insert shell namespace button */
load_string(b1, IDS_SHELL);
b1[lstrlen(b1)+1] = '\0';
SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1);
drivebarBtn.idCommand = ID_DRIVE_SHELL_NS;
SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
drivebarBtn.iString++;
#endif
/* register windows drive root strings */
SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)Globals.drives);
#endif
drivebarBtn.idCommand = ID_DRIVE_FIRST;
for(p=Globals.drives; *p; ) {
#ifdef _NO_EXTENSIONS
/* insert drive letter */
TCHAR b[3] = {tolower(*p)};
SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b);
#endif
switch(GetDriveType(p)) {
case DRIVE_REMOVABLE: drivebarBtn.iBitmap = 1; break;
case DRIVE_CDROM: drivebarBtn.iBitmap = 3; break;
case DRIVE_REMOTE: drivebarBtn.iBitmap = 4; break;
case DRIVE_RAMDISK: drivebarBtn.iBitmap = 5; break;
default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
}
SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
drivebarBtn.idCommand++;
drivebarBtn.iString++;
while(*p++);
}
}
static void refresh_drives()
{
RECT rect;
/* destroy drive bar */
DestroyWindow(Globals.hdrivebar);
Globals.hdrivebar = 0;
/* re-create drive bar */
create_drive_bar();
/* update window layout */
GetClientRect(Globals.hMainWnd, &rect);
SendMessage(Globals.hMainWnd, WM_SIZE, 0, MAKELONG(rect.right, rect.bottom));
}
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow)
{
HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, cmd, NULL/*parameters*/, NULL/*dir*/, nCmdShow);
......@@ -3737,6 +3859,7 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
break;}
case ID_REFRESH:
refresh_drives();
refresh_child(child);
break;
......@@ -4074,70 +4197,9 @@ void show_frame(HWND hwndParent, int cmdshow)
Globals.hMainWnd, 0, Globals.hInstance, &ccs);
{
TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0};
int btn = 1;
PTSTR p;
Globals.hdrivebar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,
IDW_DRIVEBAR, 2, Globals.hInstance, IDB_DRIVEBAR, &drivebarBtn,
1, 16, 13, 16, 13, sizeof(TBBUTTON));
CheckMenuItem(Globals.hMenuOptions, ID_VIEW_DRIVE_BAR, MF_BYCOMMAND|MF_CHECKED);
GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
drivebarBtn.fsStyle = BTNS_BUTTON;
#ifndef _NO_EXTENSIONS
#ifdef __WINE__
/* insert unix file system button */
b1[0] = '/';
b1[1] = '\0';
b1[2] = '\0';
SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1);
drivebarBtn.idCommand = ID_DRIVE_UNIX_FS;
SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
drivebarBtn.iString++;
#endif
#ifdef _SHELL_FOLDERS
/* insert shell namespace button */
load_string(b1, IDS_SHELL);
b1[lstrlen(b1)+1] = '\0';
SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1);
drivebarBtn.idCommand = ID_DRIVE_SHELL_NS;
SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
drivebarBtn.iString++;
#endif
CheckMenuItem(Globals.hMenuOptions, ID_VIEW_DRIVE_BAR, MF_BYCOMMAND|MF_CHECKED);
/* register windows drive root strings */
SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)Globals.drives);
#endif
drivebarBtn.idCommand = ID_DRIVE_FIRST;
for(p=Globals.drives; *p; ) {
#ifdef _NO_EXTENSIONS
/* insert drive letter */
TCHAR b[3] = {tolower(*p)};
SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b);
#endif
switch(GetDriveType(p)) {
case DRIVE_REMOVABLE: drivebarBtn.iBitmap = 1; break;
case DRIVE_CDROM: drivebarBtn.iBitmap = 3; break;
case DRIVE_REMOTE: drivebarBtn.iBitmap = 4; break;
case DRIVE_RAMDISK: drivebarBtn.iBitmap = 5; break;
default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
}
SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
drivebarBtn.idCommand++;
drivebarBtn.iString++;
while(*p++);
}
}
create_drive_bar();
{
TBBUTTON toolbarBtns[] = {
......
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