[PATCH] winspool: Implement DeleteFormA/W
Marcel Partap
mpartap at gmx.net
Sat Apr 12 16:35:21 CDT 2008
---
dlls/winspool.drv/info.c | 44 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 23be2d2..41cf76f 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -3404,8 +3404,24 @@ BOOL WINAPI ClosePrinter(HANDLE hPrinter)
*/
BOOL WINAPI DeleteFormA(HANDLE hPrinter, LPSTR pFormName)
{
- FIXME("(%p,%s): stub\n", hPrinter, pFormName);
- return 1;
+ LPWSTR formNameW;
+ DWORD len;
+
+ TRACE("(%p, %s)\n", hPrinter, pFormName);
+
+ if (!pFormName) {
+ SetLastError(RPC_X_NULL_REF_POINTER);
+ return FALSE;
+ }
+
+ len = MultiByteToWideChar(CP_ACP, 0, pFormName, -1, NULL, 0);
+ if (len <= 1) {
+ SetLastError(ERROR_INVALID_FORM_NAME);
+ return FALSE;
+ }
+ formNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pFormName, -1, formNameW, len);
+ return DeleteFormW(hPrinter, formNameW);
}
/*****************************************************************************
@@ -3413,8 +3429,28 @@ BOOL WINAPI DeleteFormA(HANDLE hPrinter, LPSTR pFormName)
*/
BOOL WINAPI DeleteFormW(HANDLE hPrinter, LPWSTR pFormName)
{
- FIXME("(%p,%s): stub\n", hPrinter, debugstr_w(pFormName));
- return 1;
+ opened_printer_t *printer;
+ HKEY hformskey;
+ BOOL res = FALSE;
+
+ TRACE("(%p, %s)\n", hPrinter, debugstr_w(pFormName));
+
+ printer = get_opened_printer(hPrinter);
+ if (!printer) {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ if (RegOpenKeyW(HKEY_LOCAL_MACHINE, FormsW, &hformskey) != ERROR_SUCCESS) {
+ ERR("could not open reg key %s", debugstr_w(FormsW));
+ return FALSE;
+ }
+ if (RegDeleteValueW(hformskey, pFormName) == ERROR_SUCCESS)
+ res = TRUE;
+ if (!res)
+ SetLastError(ERROR_INVALID_FORM_NAME);
+ RegCloseKey(hformskey);
+ return res;
}
/*****************************************************************************
--
1.5.4.5
--------------050209010203080404030702--
More information about the wine-patches
mailing list