ReactOS  0.4.15-dev-509-g96a357b
vfdguiopen.c File Reference
#include <windows.h>
#include <commdlg.h>
#include "vfdtypes.h"
#include "vfdapi.h"
#include "vfdlib.h"
#include "vfdmsg.h"
#include "vfdguirc.h"
Include dependency graph for vfdguiopen.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 
#define FALLBACK_IMAGE_FILTER
 
#define FALLBACK_IMAGE_TITLE   "Open Virtual Floppy Image"
 

Functions

static INT CALLBACK OpenDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void OnInit (HWND hDlg, ULONG nDevice)
 
static void OnImage (HWND hDlg, HWND hEdit)
 
static void OnBrowse (HWND hDlg)
 
static void OnDiskType (HWND hDlg, HWND hRadio)
 
static void OnMediaType (HWND hDlg, HWND hCombo)
 
static void OnProtect (HWND hDlg, HWND hCheck)
 
static DWORD OnOK (HWND hDlg)
 
DWORD WINAPI VfdGuiOpen (HWND hParent, ULONG nDevice)
 

Macro Definition Documentation

◆ FALLBACK_IMAGE_FILTER

#define FALLBACK_IMAGE_FILTER
Value:
"Common image files (bin,dat,fdd,flp,ima,img,vfd)\0" \
"*.bin;*.dat;*.fdd;*.flp;*.ima;*.img;*.vfd\0" \
"Zip compressed image (imz,zip)\0*.imz;*.zip\0" \
"All files (*.*)\0*.*\0"

Definition at line 39 of file vfdguiopen.c.

◆ FALLBACK_IMAGE_TITLE

#define FALLBACK_IMAGE_TITLE   "Open Virtual Floppy Image"

Definition at line 45 of file vfdguiopen.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 15 of file vfdguiopen.c.

Function Documentation

◆ OnBrowse()

void OnBrowse ( HWND  hDlg)
static

Definition at line 355 of file vfdguiopen.c.

357 {
359  PSTR title;
360  PSTR filter;
361  CHAR file[MAX_PATH];
362  CHAR dir[MAX_PATH];
363  DWORD len;
364 
365  // prepare title and filter text
366 
367  title = ModuleMessage(MSG_OPEN_TITLE);
368 
369  filter = ModuleMessage(MSG_OPEN_FILTER);
370 
371  if (filter) {
372  PSTR p = filter;
373 
374  do {
375  if (*p == '|') {
376  *p = '\0';
377  }
378  }
379  while (*(++p));
380  }
381 
382  // get current file name from the control
383 
384  ZeroMemory(file, sizeof(file));
385  ZeroMemory(dir, sizeof(dir));
386 
387  len = GetDlgItemText(hDlg, IDC_IMAGEFILE, file, sizeof(file));
388 
389  if (len && file[len - 1] == '\\') {
390  strcpy(dir, file);
391  ZeroMemory(file, sizeof(file));
392  }
393 
394  // prepare OPENFILENAME structure
395 
396  ZeroMemory(&ofn, sizeof(ofn));
397 
400 
401  ofn.hwndOwner = hDlg;
403  ofn.lpstrFile = file;
404  ofn.nMaxFile = sizeof(file);
408 
409  // show the open file dialog box
410 
411  if (GetOpenFileName(&ofn)) {
414  }
415 
416  // release text buffers
417 
418  if (filter) {
419  LocalFree(filter);
420  }
421 
422  if (title) {
423  LocalFree(title);
424  }
425 }
PSTR ModuleMessage(DWORD nFormat,...)
Definition: vfdlib.c:124
#define IS_WINDOWS_NT()
Definition: vfdcmd.c:159
HWND hwndOwner
Definition: commdlg.h:330
char CHAR
Definition: xmlstorage.h:175
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1648
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetOpenFileName
Definition: commdlg.h:665
DWORD nMaxFile
Definition: commdlg.h:337
#define IDC_IMAGEFILE
Definition: vfdguirc.h:14
#define FALLBACK_IMAGE_TITLE
Definition: vfdguiopen.c:45
unsigned int dir
Definition: maze.c:112
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
#define GetDlgItemText
Definition: winuser.h:5760
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetDlgItemText
Definition: winuser.h:5824
GLenum GLsizei len
Definition: glext.h:6722
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OPENFILENAME_SIZE_VERSION_400
Definition: commdlg.h:402
LPSTR lpstrFile
Definition: commdlg.h:336
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
signed char * PSTR
Definition: retypes.h:7
LPCSTR lpstrFilter
Definition: commdlg.h:332
LPCSTR lpstrTitle
Definition: commdlg.h:341
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLfloat GLfloat p
Definition: glext.h:8902
#define OFN_ENABLESIZING
Definition: commdlg.h:101
static char title[]
Definition: ps.c:92
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define FALLBACK_IMAGE_FILTER
Definition: vfdguiopen.c:39
DWORD Flags
Definition: commdlg.h:342
Definition: fci.c:126

Referenced by OpenDialogProc().

◆ OnDiskType()

void OnDiskType ( HWND  hDlg,
HWND  hRadio 
)
static

Definition at line 430 of file vfdguiopen.c.

433 {
435  UNREFERENCED_PARAMETER(hRadio);
436 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323

Referenced by OpenDialogProc().

◆ OnImage()

void OnImage ( HWND  hDlg,
HWND  hEdit 
)
static

Definition at line 221 of file vfdguiopen.c.

224 {
225  CHAR buf[MAX_PATH];
226  DWORD file_attr;
229  VFD_MEDIA media_type;
230 
232 
233  // Store default file size
234 
236 
237  // get currently selected media type
238 
239  media_type = (VFD_MEDIA)(SendDlgItemMessage(
240  hDlg, IDC_MEDIATYPE, CB_GETCURSEL, 0, 0) + 1);
241 
242  // clear hint and description text
243 
246 
247  // get file name and file information
248 
249  if (GetWindowText(hEdit, buf, sizeof(buf))) {
250 
252  buf, &file_attr, &file_type, &image_size);
253 
254  if (ret == ERROR_SUCCESS) {
255 
256  // use media type from image size
257 
258  media_type = VfdLookupMedia(image_size);
259  }
260  else if (ret == ERROR_FILE_NOT_FOUND) {
261 
262  // new file
263  // use the parent directory attributes
264 
265  PSTR p;
266 
267  if ((p = strrchr(buf, '\\')) != NULL) {
268  *p = '\0';
269  }
270 
271  file_attr = GetFileAttributes(buf);
272 
273  if (file_attr == INVALID_FILE_ATTRIBUTES) {
274  // directory access error
277  return;
278  }
279 
283  }
284  else {
285  // file access error
288  return;
289  }
290 
291  // make file description text
292 
293  VfdMakeFileDesc(buf, sizeof(buf),
294  file_type, image_size, file_attr);
295 
296  // set file description
297 
299  }
300  else {
301 
302  // filename is empty - RAM disk
303 
304  file_attr = 0;
307 
308  SetDlgItemText(hDlg, IDC_IMAGEFILE_DESC, "RAM");
309  }
310 
311  // store the image size
312 
314 
315  // setup disktype controls
316 
317  if (file_type != VFD_FILETYPE_RAW ||
319 
320  // file cannot be opened directly -- RAM mode is forced
321 
324 
326  }
327  else {
329  }
330 
331  // set OK button text
332 
333  if (image_size == INVALID_FILE_SIZE) {
334  // file does not exist - OK button is "Create"
335 
336  SetControlText(hDlg, IDOK, MSG_CREATE_BUTTON);
337  }
338  else {
339  // file exists - OK button is "Open"
340 
341  SetControlText(hDlg, IDOK, MSG_OPEN_BUTTON);
342  }
343 
344  // select media type
345 
347  CB_SETCURSEL, media_type - 1, 0);
348 
349  OnMediaType(hDlg, GetDlgItem(hDlg, IDC_MEDIATYPE));
350 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char CHAR
Definition: xmlstorage.h:175
#define SetWindowLong
Definition: winuser.h:5828
#define INVALID_FILE_SIZE
Definition: winbase.h:529
#define SendDlgItemMessage
Definition: winuser.h:5817
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define CB_GETCURSEL
Definition: winuser.h:1925
#define GetWindowText
Definition: winuser.h:5773
#define DWL_USER
Definition: winuser.h:861
VFD_MEDIA WINAPI VfdLookupMedia(ULONG nSize)
Definition: vfdctl.c:3256
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_MEDIATYPE
Definition: vfdguirc.h:25
static void OnMediaType(HWND hDlg, HWND hCombo)
Definition: vfdguiopen.c:441
PCSTR SystemMessage(DWORD nError)
Definition: vfdlib.c:147
#define MAX_PATH
Definition: compat.h:26
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
FD_TYPE file_type(FDSC **curr, char *fixed)
Definition: file.c:221
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define SetDlgItemText
Definition: winuser.h:5824
#define FILE_ATTRIBUTE_COMPRESSED
Definition: nt_native.h:711
int ret
UCHAR VFD_FILETYPE
Definition: vfdtypes.h:62
#define IDC_IMAGEFILE_HINT
Definition: vfdguirc.h:17
static HWND hEdit
Definition: autocomplete.c:34
#define CB_SETCURSEL
Definition: winuser.h:1943
#define IDC_DISKTYPE_FILE
Definition: vfdguirc.h:22
#define IDC_IMAGEFILE_DESC
Definition: vfdguirc.h:16
#define GetFileAttributes
Definition: winbase.h:3655
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define FILE_ATTRIBUTE_ENCRYPTED
Definition: ntifs_ex.h:385
signed char * PSTR
Definition: retypes.h:7
DWORD WINAPI VfdCheckImageFile(PCSTR sFileName, PDWORD pAttributes, PVFD_FILETYPE pFileType, PULONG pImageSize)
Definition: vfdctl.c:3035
unsigned int ULONG
Definition: retypes.h:1
void WINAPI VfdMakeFileDesc(PSTR pBuffer, ULONG nBufSize, VFD_FILETYPE nFileType, ULONG nFileSize, DWORD nFileAttr)
Definition: vfdguiut.c:376
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define IDC_DISKTYPE_RAM
Definition: vfdguirc.h:23
GLfloat GLfloat p
Definition: glext.h:8902
UCHAR VFD_MEDIA
Definition: vfdtypes.h:61
void SetControlText(HWND hWnd, UINT nCtrl, DWORD nMsg)
Definition: vfdguiut.c:350
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858

Referenced by OnInit(), and OpenDialogProc().

◆ OnInit()

void OnInit ( HWND  hDlg,
ULONG  nDevice 
)
static

Definition at line 167 of file vfdguiopen.c.

170 {
171  VFD_MEDIA i;
172 
173  // Store the device number
174 
175  SetWindowLong(hDlg, GWL_USERDATA, nDevice);
176 
177  // Store default file size
178 
180 
181  // Set dialog window title
182 
183  SetControlText(hDlg, 0, MSG_OPEN_TITLE);
184 
185  // Set control captions
186 
187  SetControlText(hDlg, IDC_IMAGEFILE_LABEL, MSG_IMAGEFILE_ACCEL);
188  SetControlText(hDlg, IDC_IMAGEDESC_LABEL, MSG_DESCRIPTION_LABEL);
189  SetControlText(hDlg, IDC_BROWSE, MSG_BROWSE_BUTTON);
190  SetControlText(hDlg, IDC_DISKTYPE_LABEL, MSG_DISKTYPE_LABEL);
191  SetControlText(hDlg, IDC_MEDIATYPE_LABEL, MSG_MEDIATYPE_ACCEL);
192  SetControlText(hDlg, IDC_OPEN_PROTECTED, MSG_MENU_PROTECT);
193  SetControlText(hDlg, IDOK, MSG_CREATE_BUTTON);
194  SetControlText(hDlg, IDCANCEL, MSG_CANCEL_BUTTON);
195 
196  // select RAM disk as default
197 
200 
201  // setup media type combo list
202 
203  for (i = 1; i < VFD_MEDIA_MAX; i++) {
206  }
207 
208  // select 1.44MB as the default
209 
212 
213  // set up other controls
214 
215  OnImage(hDlg, GetDlgItem(hDlg, IDC_IMAGEFILE));
216 }
#define IDOK
Definition: winuser.h:824
#define IDC_DISKTYPE_LABEL
Definition: vfdguirc.h:20
#define IDC_BROWSE
Definition: resource.h:21
#define IDC_MEDIATYPE_LABEL
Definition: vfdguirc.h:24
static void OnImage(HWND hDlg, HWND hEdit)
Definition: vfdguiopen.c:221
#define GWL_USERDATA
Definition: winuser.h:855
UINT_PTR WPARAM
Definition: windef.h:207
#define SetWindowLong
Definition: winuser.h:5828
#define INVALID_FILE_SIZE
Definition: winbase.h:529
#define SendDlgItemMessage
Definition: winuser.h:5817
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DWL_USER
Definition: winuser.h:861
#define IDC_IMAGEFILE
Definition: vfdguirc.h:14
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_MEDIATYPE
Definition: vfdguirc.h:25
#define IDC_IMAGEFILE_LABEL
Definition: vfdguirc.h:13
PCSTR WINAPI VfdMediaTypeName(VFD_MEDIA nMediaType)
Definition: vfdctl.c:3280
#define CB_SELECTSTRING
Definition: winuser.h:1942
#define IDC_OPEN_PROTECTED
Definition: vfdguirc.h:27
#define IDC_DISKTYPE_FILE
Definition: vfdguirc.h:22
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define IDC_DISKTYPE_RAM
Definition: vfdguirc.h:23
#define IDCANCEL
Definition: winuser.h:825
#define IDC_IMAGEDESC_LABEL
Definition: vfdguirc.h:15
UCHAR VFD_MEDIA
Definition: vfdtypes.h:61
void SetControlText(HWND hWnd, UINT nCtrl, DWORD nMsg)
Definition: vfdguiut.c:350

Referenced by OpenDialogProc().

◆ OnMediaType()

void OnMediaType ( HWND  hDlg,
HWND  hCombo 
)
static

Definition at line 441 of file vfdguiopen.c.

444 {
445  VFD_MEDIA media_type;
446  ULONG media_size;
448 
450 
451  if (image_size == INVALID_FILE_SIZE) {
452  return;
453  }
454 
455  media_type = (VFD_MEDIA)(SendMessage(
456  hCombo, CB_GETCURSEL, 0, 0) + 1);
457 
458  if (media_type == 0) {
459  return;
460  }
461 
462  media_size = VfdGetMediaSize(media_type);
463 
464  if (media_size > image_size) {
465  // selected media is too large
466  SetControlText(hDlg, IDC_IMAGEFILE_HINT, MSG_FILE_TOO_SMALL);
468  return;
469  }
470  else if (media_size < image_size) {
471  SetControlText(hDlg, IDC_IMAGEFILE_HINT, MSG_SIZE_MISMATCH);
472  }
473  else {
475  }
476 
477  EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
478 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
ULONG WINAPI VfdGetMediaSize(VFD_MEDIA nMediaType)
Definition: vfdctl.c:3272
#define INVALID_FILE_SIZE
Definition: winbase.h:529
#define CB_GETCURSEL
Definition: winuser.h:1925
#define DWL_USER
Definition: winuser.h:861
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SetDlgItemText
Definition: winuser.h:5824
#define IDC_IMAGEFILE_HINT
Definition: vfdguirc.h:17
#define GetWindowLong
Definition: winuser.h:5771
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SendMessage
Definition: winuser.h:5818
unsigned int ULONG
Definition: retypes.h:1
UCHAR VFD_MEDIA
Definition: vfdtypes.h:61
void SetControlText(HWND hWnd, UINT nCtrl, DWORD nMsg)
Definition: vfdguiut.c:350
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858

Referenced by OnImage(), and OpenDialogProc().

◆ OnOK()

DWORD OnOK ( HWND  hDlg)
static

Definition at line 494 of file vfdguiopen.c.

496 {
498  VFD_DISKTYPE disk_type;
499  VFD_MEDIA media_type;
500  VFD_FLAGS image_flags;
501  HANDLE hDevice;
502  DWORD ret;
503 
504  // get the disk type
505 
507  disk_type = VFD_DISKTYPE_FILE;
508  }
509  else {
510  disk_type = VFD_DISKTYPE_RAM;
511  }
512 
513  // get the media type
514 
515  media_type = (VFD_MEDIA)(SendDlgItemMessage(
516  hDlg, IDC_MEDIATYPE, CB_GETCURSEL, 0, 0) + 1);
517 
518  // get the protect flag
519 
521  image_flags = VFD_FLAG_WRITE_PROTECTED;
522  }
523  else {
524  image_flags = 0;
525  }
526 
527  // get the image name to create
528 
529  if (GetDlgItemText(hDlg, IDC_IMAGEFILE, file_name, sizeof(file_name))) {
530 
531  // file is specified
532 
533  if (GetWindowLong(hDlg, DWL_USER) == INVALID_FILE_SIZE) {
534 
535  // create a new image
536 
538  file_name, media_type, VFD_FILETYPE_RAW, FALSE);
539 
540  if (ret != ERROR_SUCCESS) {
541  goto exit_func;
542  }
543  }
544  }
545 
546  // open the image
547 
548  hDevice = VfdOpenDevice(GetWindowLong(hDlg, GWL_USERDATA));
549 
550  if (hDevice == INVALID_HANDLE_VALUE) {
551  ret = GetLastError();
552  goto exit_func;
553  }
554 
555  ret = VfdOpenImage(
556  hDevice, file_name, disk_type, media_type, image_flags);
557 
558  CloseHandle(hDevice);
559 
560 exit_func:
561  if (ret != ERROR_SUCCESS) {
562 
563  // show error message
564 
567  }
568 
569  return ret;
570 }
#define CloseHandle
Definition: compat.h:407
#define ERROR_SUCCESS
Definition: deptool.c:10
#define VFD_MSGBOX_TITLE
Definition: vfdlib.h:53
UCHAR VFD_DISKTYPE
Definition: vfdtypes.h:60
char CHAR
Definition: xmlstorage.h:175
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define GWL_USERDATA
Definition: winuser.h:855
UCHAR VFD_FLAGS
Definition: vfdtypes.h:63
#define INVALID_FILE_SIZE
Definition: winbase.h:529
#define SendDlgItemMessage
Definition: winuser.h:5817
#define MB_ICONSTOP
Definition: winuser.h:797
DWORD WINAPI VfdCreateImageFile(PCSTR sFileName, VFD_MEDIA nMediaType, VFD_FILETYPE nFileType, BOOL bOverWrite)
Definition: vfdctl.c:3126
#define CB_GETCURSEL
Definition: winuser.h:1925
#define DWL_USER
Definition: winuser.h:861
#define IDC_IMAGEFILE
Definition: vfdguirc.h:14
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define VFD_FLAG_WRITE_PROTECTED
Definition: vfdtypes.h:68
#define GetDlgItemText
Definition: winuser.h:5760
#define IDC_MEDIATYPE
Definition: vfdguirc.h:25
PCSTR SystemMessage(DWORD nError)
Definition: vfdlib.c:147
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define GetWindowLong
Definition: winuser.h:5771
#define IDC_OPEN_PROTECTED
Definition: vfdguirc.h:27
#define MessageBox
Definition: winuser.h:5797
HANDLE WINAPI VfdOpenDevice(ULONG nTarget)
Definition: vfdctl.c:1215
#define IDC_DISKTYPE_FILE
Definition: vfdguirc.h:22
NTSTATUS VfdOpenImage(IN PDEVICE_EXTENSION DeviceExtension, IN PVFD_IMAGE_INFO ImageInfo)
Definition: vfdimg.c:104
#define BST_CHECKED
Definition: winuser.h:197
static LPCWSTR file_name
Definition: protocol.c:147
UCHAR VFD_MEDIA
Definition: vfdtypes.h:61

Referenced by OpenDialogProc().

◆ OnProtect()

void OnProtect ( HWND  hDlg,
HWND  hCheck 
)
static

Definition at line 483 of file vfdguiopen.c.

486 {
488  UNREFERENCED_PARAMETER(hCheck);
489 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323

Referenced by OpenDialogProc().

◆ OpenDialogProc()

INT CALLBACK OpenDialogProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 97 of file vfdguiopen.c.

105 {
106  switch (uMsg) {
107  case WM_INITDIALOG:
108  OnInit(hDlg, lParam);
109  return TRUE;
110 
111  case WM_COMMAND:
112  switch (wParam) {
114  OnImage(hDlg, (HWND)lParam);
115  return TRUE;
116 
117  case IDC_BROWSE:
118  OnBrowse(hDlg);
119  return TRUE;
120 
121  case IDC_DISKTYPE_FILE:
122  case IDC_DISKTYPE_RAM:
123  OnDiskType(hDlg, (HWND)lParam);
124  return TRUE;
125 
127  OnMediaType(hDlg, (HWND)lParam);
128  return TRUE;
129 
130  case IDC_OPEN_PROTECTED:
131  OnProtect(hDlg, (HWND)lParam);
132  return TRUE;
133 
134  case IDOK:
135  if (OnOK(hDlg) == ERROR_SUCCESS) {
136  EndDialog(hDlg, IDOK);
137  }
138  return TRUE;
139 
140  case IDCANCEL:
141  EndDialog(hDlg, IDCANCEL);
142  return TRUE;
143  }
144  break;
145 
146  case WM_CONTEXTMENU:
148  break;
149 
150  case WM_HELP:
151  {
153 
154  if (info->iContextType == HELPINFO_WINDOW) {
155  ShowHelpWindow(hDlg, info->iCtrlId);
156  }
157  }
158  return TRUE;
159  }
160 
161  return FALSE;
162 }
static void OnDiskType(HWND hDlg, HWND hRadio)
Definition: vfdguiopen.c:430
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
static void OnInit(HWND hDlg, ULONG nDevice)
Definition: vfdguiopen.c:167
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define IDC_BROWSE
Definition: resource.h:21
static void OnImage(HWND hDlg, HWND hEdit)
Definition: vfdguiopen.c:221
static void OnProtect(HWND hDlg, HWND hCheck)
Definition: vfdguiopen.c:483
void ShowHelpWindow(HWND hDlg, UINT nCtl)
Definition: vfdguiut.c:507
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
struct tagHELPINFO * LPHELPINFO
static void OnBrowse(HWND hDlg)
Definition: vfdguiopen.c:355
#define IDC_IMAGEFILE
Definition: vfdguirc.h:14
#define MAKELONG(a, b)
Definition: typedefs.h:248
#define IDC_MEDIATYPE
Definition: vfdguirc.h:25
static void OnMediaType(HWND hDlg, HWND hCombo)
Definition: vfdguiopen.c:441
#define IDC_OPEN_PROTECTED
Definition: vfdguirc.h:27
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_DISKTYPE_FILE
Definition: vfdguirc.h:22
static DWORD OnOK(HWND hDlg)
Definition: vfdguiopen.c:494
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define IDC_DISKTYPE_RAM
Definition: vfdguirc.h:23
#define IDCANCEL
Definition: winuser.h:825
#define HELPINFO_WINDOW
Definition: winuser.h:1158
static VOID ShowContextMenu(HWND hwndDlg, HWND hwndTreeView, PHOTPLUG_DATA pHotplugData)
Definition: hotplug.c:317
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by VfdGuiOpen().

◆ VfdGuiOpen()

DWORD WINAPI VfdGuiOpen ( HWND  hParent,
ULONG  nDevice 
)

Definition at line 71 of file vfdguiopen.c.

74 {
75  switch (DialogBoxParam(
78  hParent,
80  nDevice))
81  {
82  case IDOK:
83  return ERROR_SUCCESS;
84 
85  case IDCANCEL:
86  return ERROR_CANCELLED;
87 
88  default:
89  return GetLastError();
90  }
91 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDOK
Definition: winuser.h:824
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HINSTANCE g_hDllModule
#define DialogBoxParam
Definition: winuser.h:5739
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define ERROR_CANCELLED
Definition: winerror.h:726
static INT CALLBACK OpenDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: vfdguiopen.c:97
#define IDD_OPENDIALOG
Definition: vfdguirc.h:6
#define IDCANCEL
Definition: winuser.h:825

Referenced by CVfdShExt::DoVfdOpen().