Ricardo Filipe : setupapi: Implement Ok button action in SetupPromptForDiskW dialog.
Alexandre Julliard
julliard at winehq.org
Mon Feb 23 10:00:41 CST 2009
Module: wine
Branch: master
Commit: 5a0079f6ca7d846b7b3b7c88e92ae267c3e9440f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5a0079f6ca7d846b7b3b7c88e92ae267c3e9440f
Author: Ricardo Filipe <ricardo_barbano at hotmail.com>
Date: Wed Feb 18 03:46:01 2009 +0000
setupapi: Implement Ok button action in SetupPromptForDiskW dialog.
---
dlls/setupapi/dialog.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index 28c8e9f..aaa9453 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -90,6 +90,40 @@ static void promptdisk_init(HWND hwnd, struct promptdisk_params *params)
ShowWindow(GetDlgItem(hwnd, IDC_RUNDLG_BROWSE), SW_HIDE);
}
+/* When the user clicks in the Ok button in SetupPromptForDisk dialog
+ * if the parameters are good it copies the path from the dialog to the output buffer
+ * saves the required size for the buffer if PathRequiredSize is given
+ * returns NO_ERROR if there is no PathBuffer to copy too
+ * returns DPROMPT_BUFFERTOOSMALL if the path is too big to fit in PathBuffer
+ */
+static void promptdisk_ok(HWND hwnd, struct promptdisk_params *params)
+{
+ int requiredSize;
+ WCHAR aux[MAX_PATH];
+ GetWindowTextW(GetDlgItem(hwnd, IDC_PATH), aux, MAX_PATH);
+ requiredSize = strlenW(aux)+1;
+
+ if(params->PathRequiredSize)
+ {
+ *params->PathRequiredSize = requiredSize;
+ TRACE("returning PathRequiredSize=%d\n",*params->PathRequiredSize);
+ }
+ if(!params->PathBuffer && !params->PathBufferSize)
+ {
+ EndDialog(hwnd, NO_ERROR);
+ return;
+ }
+ if(params->PathBuffer && (requiredSize > params->PathBufferSize
+ || params->PathBufferSize < MAX_PATH))
+ {
+ EndDialog(hwnd, DPROMPT_BUFFERTOOSMALL);
+ return;
+ }
+ strcpyW(params->PathBuffer, aux);
+ TRACE("returning PathBuffer=%s\n", debugstr_w(params->PathBuffer));
+ EndDialog(hwnd, DPROMPT_SUCCESS);
+}
+
/* When the user clicks the browse button in SetupPromptForDisk dialog
* it copies the path of the selected file to the dialog path field
*/
@@ -126,6 +160,13 @@ static INT_PTR CALLBACK promptdisk_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case WM_COMMAND:
switch(wParam)
{
+ case IDOK:
+ {
+ struct promptdisk_params *params =
+ (struct promptdisk_params *)GetWindowLongPtrW(hwnd, DWLP_USER);
+ promptdisk_ok(hwnd, params);
+ return TRUE;
+ }
case IDCANCEL:
EndDialog(hwnd, DPROMPT_CANCEL);
return TRUE;
More information about the wine-cvs
mailing list