--- np2/win9x/dialog/d_disk.cpp 2003/10/28 18:21:05 1.3 +++ np2/win9x/dialog/d_disk.cpp 2003/10/29 21:35:58 1.4 @@ -3,6 +3,7 @@ #include "resource.h" #include "np2.h" #include "dosio.h" +#include "sysmng.h" #include "toolwin.h" #include "dialog.h" #include "dialogs.h" @@ -47,28 +48,30 @@ static const FILESEL newdiskui = {newdis void dialog_changefdd(HWND hWnd, BYTE drv) { -const char *p; + char path[MAX_PATH]; int readonly; if (drv < 4) { - p = dlgs_selectfile(hWnd, &fddui, fdd_diskname(drv), - fddfolder, sizeof(fddfolder), &readonly); - if (p != NULL) { - diskdrv_setfdd(drv, p, readonly); - toolwin_setfdd(drv, p); + file_cpyname(path, fdd_diskname(drv), sizeof(path)); + if (dlgs_selectfile(hWnd, &fddui, path, sizeof(path), &readonly)) { + file_cpyname(fddfolder, path, sizeof(fddfolder)); + sysmng_update(SYS_UPDATEOSCFG); + diskdrv_setfdd(drv, path, readonly); + toolwin_setfdd(drv, path); } } } void dialog_changehdd(HWND hWnd, BYTE drv) { -const char *p; + char path[MAX_PATH]; if (drv < 2) { - p = dlgs_selectfile(hWnd, &hddui, np2cfg.hddfile[drv], - hddfolder, sizeof(hddfolder), NULL); - if (p != NULL) { - diskdrv_sethdd(drv, p); + file_cpyname(path, np2cfg.hddfile[drv], sizeof(path)); + if (dlgs_selectfile(hWnd, &hddui, path, sizeof(path), NULL)) { + file_cpyname(hddfolder, path, sizeof(hddfolder)); + sysmng_update(SYS_UPDATEOSCFG); + diskdrv_sethdd(drv, path); } } } @@ -196,30 +199,28 @@ static LRESULT CALLBACK NewdiskDlgProc(H void dialog_newdisk(HWND hWnd) { char path[MAX_PATH]; -const char *p; HINSTANCE hinst; file_cpyname(path, fddfolder, sizeof(path)); file_cutname(path); file_catname(path, str_newdisk, sizeof(path)); - p = dlgs_selectwritefile(hWnd, &newdiskui, path, NULL, 0); - if (p == NULL) { + if (!dlgs_selectwritefile(hWnd, &newdiskui, path, sizeof(path))) { return; } hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); - if (!file_cmpname(file_getext((char *)p), str_thd)) { + if (!file_cmpname(file_getext(path), str_thd)) { hddsize = 0; if (DialogBox(hinst, MAKEINTRESOURCE(IDD_NEWHDDDISK), hWnd, (DLGPROC)NewHddDlgProc) == IDOK) { - newdisk_hdd(p, hddsize); // (hddsize < 5) || (hddsize > 256) + newdisk_hdd(path, hddsize); // (hddsize < 5) || (hddsize > 256) } } else { if (DialogBox(hinst, MAKEINTRESOURCE(np2cfg.usefd144?IDD_NEWDISK2:IDD_NEWDISK), hWnd, (DLGPROC)NewdiskDlgProc) == IDOK) { - newdisk_fdd(p, makefdtype, disklabel); + newdisk_fdd(path, makefdtype, disklabel); } } }