ReactOS  0.4.15-dev-484-g89e716a7
vfdshprop.cpp File Reference
#include <windows.h>
#include <shellapi.h>
#include <shlobj.h>
#include <stdio.h>
#include "vfdtypes.h"
#include "vfdapi.h"
#include "vfdlib.h"
#include "vfdver.h"
#include "vfdmsg.h"
#include "vfdguirc.h"
#include "vfdshext.h"
Include dependency graph for vfdshprop.cpp:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 
#define VFD_PROPERTY_ID   "VFD"
 

Functions

static BOOL CALLBACK VfdPageDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
 
static UINT CALLBACK VfdPageCallback (HWND hWnd, UINT uMessage, LPPROPSHEETPAGE ppsp)
 
static void OnPropInit (HWND hDlg)
 
static void OnControl (HWND hDlg)
 
static void UpdateImageInfo (HWND hDlg, ULONG nDevice)
 

Macro Definition Documentation

◆ VFD_PROPERTY_ID

#define VFD_PROPERTY_ID   "VFD"

Definition at line 33 of file vfdshprop.cpp.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 11 of file vfdshprop.cpp.

Function Documentation

◆ OnControl()

void OnControl ( HWND  hDlg)
static

Definition at line 234 of file vfdshprop.cpp.

236 {
237  CHAR module_path[MAX_PATH];
238  CHAR full_path[MAX_PATH];
239  PSTR file_name;
240 #ifndef __REACTOS__
241  DWORD ret;
242 #else
243  DWORD_PTR ret;
244 #endif
245 
247  g_hDllModule, module_path, sizeof(module_path));
248 
249  if (ret == 0 || ret >= sizeof(module_path)) {
250  file_name = full_path;
251  }
252  else {
254  module_path, sizeof(full_path), full_path, &file_name);
255 
256  if (ret == 0 || ret >= sizeof(full_path)) {
257  file_name = full_path;
258  }
259  }
260 
261  strcpy(file_name, "vfdwin.exe");
262 
263  VFDTRACE(0, ("Starting %s\n", full_path));
264 
265 #ifndef __REACTOS__
267  hDlg, NULL, full_path, NULL, NULL, SW_SHOW);
268 #else
270  hDlg, NULL, full_path, NULL, NULL, SW_SHOW);
271 #endif
272 
273  if (ret > 32) {
275  }
276  else {
279  }
280 }
#define DWORD_PTR
Definition: treelist.c:76
#define VFD_MSGBOX_TITLE
Definition: vfdlib.h:53
char CHAR
Definition: xmlstorage.h:175
#define MB_ICONSTOP
Definition: winuser.h:797
#define DWORD
Definition: nt_native.h:44
#define ShellExecute
Definition: shellapi.h:689
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
#define PSBTN_CANCEL
Definition: prsht.h:151
PCSTR SystemMessage(DWORD nError)
Definition: vfdlib.c:147
#define MAX_PATH
Definition: compat.h:26
HINSTANCE g_hDllModule
unsigned long DWORD
Definition: ntddk_ex.h:95
#define VFDTRACE(LEVEL, STRING)
Definition: vfddbg.h:72
#define GetModuleFileName
Definition: winbase.h:3671
int ret
#define GetFullPathName
Definition: winbase.h:3661
#define MessageBox
Definition: winuser.h:5797
uint32_t DWORD_PTR
Definition: typedefs.h:64
HWND WINAPI GetParent(_In_ HWND)
signed char * PSTR
Definition: retypes.h:7
static LPCWSTR file_name
Definition: protocol.c:147
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348

Referenced by VfdPageDlgProc().

◆ OnPropInit()

void OnPropInit ( HWND  hDlg)
static

Definition at line 211 of file vfdshprop.cpp.

213 {
214  // set up control text
215 
218 
219  SetControlText(hDlg, IDC_IMAGEFILE_LABEL, MSG_IMAGEFILE_LABEL);
220  SetControlText(hDlg, IDC_IMAGEDESC_LABEL, MSG_DESCRIPTION_LABEL);
221  SetControlText(hDlg, IDC_DISKTYPE_LABEL, MSG_DISKTYPE_LABEL);
222  SetControlText(hDlg, IDC_MEDIATYPE_LABEL, MSG_MEDIATYPE_LABEL);
223  SetControlText(hDlg, IDC_WRITE_PROTECTED, MSG_MENU_PROTECT);
224  SetControlText(hDlg, IDC_OPEN, MSG_OPEN_BUTTON);
225  SetControlText(hDlg, IDC_SAVE, MSG_SAVE_BUTTON);
226  SetControlText(hDlg, IDC_CLOSE, MSG_CLOSE_BUTTON);
227  SetControlText(hDlg, IDC_FORMAT, MSG_FORMAT_BUTTON);
228  SetControlText(hDlg, IDC_CONTROL, MSG_CONTROL_BUTTON);
229 }
#define IDC_DISKTYPE_LABEL
Definition: vfdguirc.h:20
#define IDC_MEDIATYPE_LABEL
Definition: vfdguirc.h:24
#define IDC_SAVE
Definition: resource.h:16
#define IDC_CLOSE
Definition: resource.h:52
#define IDC_PROPERTY_TITLE
Definition: vfdguirc.h:11
#define IDC_CONTROL
Definition: vfdguirc.h:33
#define IDC_IMAGEFILE_LABEL
Definition: vfdguirc.h:13
#define SetDlgItemText
Definition: winuser.h:5824
#define IDC_OPEN
Definition: resource.h:18
#define IDC_WRITE_PROTECTED
Definition: vfdguirc.h:26
#define VFD_PRODUCT_DESC
Definition: vfdver.h:66
#define VFD_COPYRIGHT_STR
Definition: vfdver.h:69
#define IDC_COPYRIGHT_STR
Definition: vfdguirc.h:12
#define IDC_IMAGEDESC_LABEL
Definition: vfdguirc.h:15
void SetControlText(HWND hWnd, UINT nCtrl, DWORD nMsg)
Definition: vfdguiut.c:350
#define IDC_FORMAT
Definition: vfdguirc.h:32

Referenced by VfdPageDlgProc().

◆ UpdateImageInfo()

void UpdateImageInfo ( HWND  hDlg,
ULONG  nDevice 
)
static

Definition at line 285 of file vfdshprop.cpp.

288 {
289  HANDLE hDevice;
290  CHAR buf[MAX_PATH];
291  VFD_DISKTYPE disk_type;
292  VFD_MEDIA media_type;
293  VFD_FLAGS media_flags;
296  DWORD attrib;
297  ULONG ret;
298 
299  hDevice = VfdOpenDevice(nDevice);
300 
301  if (hDevice == INVALID_HANDLE_VALUE) {
302  MessageBox(hDlg,
305  return;
306  }
307 
308  // get current image information
309 
311  hDevice,
312  buf,
313  &disk_type,
314  &media_type,
315  &media_flags,
316  &file_type,
317  &image_size);
318 
319  CloseHandle(hDevice);
320 
321  if (ret != ERROR_SUCCESS) {
322  MessageBox(hDlg,
325  return;
326  }
327 
328  if (media_type == VFD_MEDIA_NONE) {
329 
330  // drive is empty
331 
336 
342 
345 
346  SetFocus(GetDlgItem(hDlg, IDC_OPEN));
347 
348  return;
349  }
350 
351  // display image file name
352 
353  if (buf[0]) {
354  attrib = GetFileAttributes(buf);
355 
356  if (attrib == INVALID_FILE_ATTRIBUTES) {
357  attrib = 0;
358  }
359  }
360  else {
361  if (disk_type != VFD_DISKTYPE_FILE) {
362  strcpy(buf, "<RAM>");
363  }
364  attrib = 0;
365  }
366 
368 
369  // display image description
370 
371  VfdMakeFileDesc(buf, sizeof(buf),
372  file_type, image_size, attrib);
373 
375 
376  // display disk type
377 
378  if (disk_type == VFD_DISKTYPE_FILE) {
379  SetDlgItemText(hDlg, IDC_DISKTYPE, "FILE");
380  }
381  else {
382  SetDlgItemText(hDlg, IDC_DISKTYPE, "RAM");
383  }
384 
385  // display media type
386 
388  VfdMediaTypeName(media_type));
389 
390  // set write protect check box
391 
392  if (media_flags & VFD_FLAG_WRITE_PROTECTED) {
394  }
395  else {
397  }
398 
404 
407 
408  SetFocus(GetDlgItem(hDlg, IDC_CLOSE));
409 }
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
#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
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char CHAR
Definition: xmlstorage.h:175
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HWND WINAPI SetFocus(_In_opt_ HWND)
UCHAR VFD_FLAGS
Definition: vfdtypes.h:63
#define MB_ICONSTOP
Definition: winuser.h:797
#define IDC_SAVE
Definition: resource.h:16
#define IDC_IMAGEFILE
Definition: vfdguirc.h:14
#define IDC_CLOSE
Definition: resource.h:52
smooth NULL
Definition: ftsmooth.c:416
#define VFD_FLAG_WRITE_PROTECTED
Definition: vfdtypes.h:68
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_SETSTYLE
Definition: winuser.h:1906
#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
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
PCSTR WINAPI VfdMediaTypeName(VFD_MEDIA nMediaType)
Definition: vfdctl.c:3280
int ret
UCHAR VFD_FILETYPE
Definition: vfdtypes.h:62
#define MessageBox
Definition: winuser.h:5797
HANDLE WINAPI VfdOpenDevice(ULONG nTarget)
Definition: vfdctl.c:1215
#define BST_UNCHECKED
Definition: winuser.h:199
#define IDC_IMAGEFILE_DESC
Definition: vfdguirc.h:16
#define IDC_DISKTYPE
Definition: vfdguirc.h:21
#define GetFileAttributes
Definition: winbase.h:3655
DWORD WINAPI VfdGetImageInfo(HANDLE hDevice, PSTR sFileName, PVFD_DISKTYPE pDiskType, PVFD_MEDIA pMediaType, PVFD_FLAGS pMediaFlags, PVFD_FILETYPE pFileType, PULONG pImageSize)
Definition: vfdctl.c:1839
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_OPEN
Definition: resource.h:18
#define IDC_WRITE_PROTECTED
Definition: vfdguirc.h:26
#define BST_CHECKED
Definition: winuser.h:197
#define SendMessage
Definition: winuser.h:5818
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
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
UCHAR VFD_MEDIA
Definition: vfdtypes.h:61
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858
#define IDC_FORMAT
Definition: vfdguirc.h:32

Referenced by VfdPageDlgProc().

◆ VfdPageCallback()

UINT CALLBACK VfdPageCallback ( HWND  hWnd,
UINT  uMessage,
LPPROPSHEETPAGE  ppsp 
)
static

Definition at line 60 of file vfdshprop.cpp.

64 {
66 
67  switch(uMessage) {
68  case PSPCB_CREATE:
69  return TRUE;
70 
71  case PSPCB_RELEASE:
72  if (ppsp->lParam) {
73  ((LPCVFDSHEXT)(ppsp->lParam))->Release();
74  }
75  return TRUE;
76  }
77  return TRUE;
78 }
#define TRUE
Definition: types.h:120
_In_ BOOLEAN Release
Definition: classpnp.h:929
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
HWND hWnd
Definition: settings.c:17
CVfdShExt * LPCVFDSHEXT
Definition: vfdshext.h:101
#define PSPCB_RELEASE
Definition: prsht.h:37
#define PSPCB_CREATE
Definition: prsht.h:38

Referenced by CVfdShExt::AddPages().

◆ VfdPageDlgProc()

BOOL CALLBACK VfdPageDlgProc ( HWND  hDlg,
UINT  uMessage,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 84 of file vfdshprop.cpp.

92 {
93  LPPROPSHEETPAGE psp;
94  LPCVFDSHEXT lpcs;
95 
96  switch (uMessage) {
97  case WM_INITDIALOG:
98 #ifndef __REACTOS__
100 #else
102 #endif
103 
104  if (lParam) {
106 
107  OnPropInit(hDlg);
108  UpdateImageInfo(hDlg, lpcs->GetDevice());
109  }
110  return TRUE;
111 
112  case WM_COMMAND:
113 #ifndef __REACTOS__
114  psp = (LPPROPSHEETPAGE)GetWindowLong(hDlg, DWL_USER);
115 #else
117 #endif
118 
119  if (!psp) {
120  break;
121  }
122 
123  lpcs = (LPCVFDSHEXT)psp->lParam;
124 
125  if (!lpcs) {
126  break;
127  }
128 
129  switch (wParam) {
130  case IDC_OPEN:
131  if (lpcs->DoVfdOpen(hDlg) == ERROR_SUCCESS) {
134  }
135  UpdateImageInfo(hDlg, lpcs->GetDevice());
136  break;
137 
138  case IDC_SAVE:
139  if (lpcs->DoVfdSave(hDlg) == ERROR_SUCCESS) {
142  }
143  UpdateImageInfo(hDlg, lpcs->GetDevice());
144  break;
145 
146  case IDC_CLOSE:
147  if (lpcs->DoVfdClose(hDlg) == ERROR_SUCCESS) {
150  }
151  UpdateImageInfo(hDlg, lpcs->GetDevice());
152  break;
153 
154  case IDC_WRITE_PROTECTED:
155  lpcs->DoVfdProtect(hDlg);
156  break;
157 
158  case IDC_FORMAT:
159  VfdGuiFormat(hDlg, lpcs->GetDevice());
160  break;
161 
162  case IDC_CONTROL:
163  OnControl(hDlg);
164  break;
165  }
166  break;
167 
168  case WM_CONTEXTMENU:
170  break;
171 
172  case WM_HELP:
173  {
175 
176  if (info->iContextType == HELPINFO_WINDOW) {
177  ShowHelpWindow(hDlg, info->iCtrlId);
178  }
179  }
180  return TRUE;
181 
182  default:
183  if (uMessage == g_nNotifyMsg) {
184 #ifndef __REACTOS__
185  psp = (LPPROPSHEETPAGE)GetWindowLong(hDlg, DWL_USER);
186 #else
188 #endif
189 
190  if (!psp) {
191  break;
192  }
193 
194  lpcs = (LPCVFDSHEXT)psp->lParam;
195 
196  if (!lpcs) {
197  break;
198  }
199 
200  UpdateImageInfo(hDlg, lpcs->GetDevice());
201  }
202  break;
203  }
204 
205  return FALSE;
206 }
#define TRUE
Definition: types.h:120
DWORD DoVfdClose(HWND hParent)
Definition: vfdshmenu.cpp:484
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WM_CONTEXTMENU
Definition: richedit.h:64
DWORD DoVfdOpen(HWND hParent)
Definition: vfdshmenu.cpp:459
DWORD WINAPI VfdGuiFormat(HWND hParent, ULONG nDevice)
Definition: vfdguiut.c:262
DWORD DoVfdProtect(HWND hParent)
Definition: vfdshmenu.cpp:493
#define SetWindowLong
Definition: winuser.h:5828
DWORD DoVfdSave(HWND hParent)
Definition: vfdshmenu.cpp:475
#define IDC_SAVE
Definition: resource.h:16
void ShowHelpWindow(HWND hDlg, UINT nCtl)
Definition: vfdguiut.c:507
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
struct tagHELPINFO * LPHELPINFO
static void UpdateImageInfo(HWND hDlg, ULONG nDevice)
Definition: vfdshprop.cpp:285
CVfdShExt * LPCVFDSHEXT
Definition: vfdshext.h:101
#define DWL_USER
Definition: winuser.h:861
#define IDC_CLOSE
Definition: resource.h:52
#define LPPROPSHEETPAGE
Definition: prsht.h:390
static void OnPropInit(HWND hDlg)
Definition: vfdshprop.cpp:211
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define BM_SETSTYLE
Definition: winuser.h:1906
#define IDC_CONTROL
Definition: vfdguirc.h:33
ULONG GetDevice()
Definition: vfdshext.h:44
#define GetWindowLong
Definition: winuser.h:5771
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define IDC_OPEN
Definition: resource.h:18
#define IDC_WRITE_PROTECTED
Definition: vfdguirc.h:26
UINT g_nNotifyMsg
#define SendMessage
Definition: winuser.h:5818
#define GetWindowLongPtr
Definition: treelist.c:73
#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
static void OnControl(HWND hDlg)
Definition: vfdshprop.cpp:234
#define IDC_FORMAT
Definition: vfdguirc.h:32

Referenced by CVfdShExt::AddPages().