[PATCH] winspool: Implement DeleteFormA/W
Marcel Partap
mpartap at gmx.net
Sun Apr 27 14:51:31 CDT 2008
---
dlls/winspool.drv/info.c | 47 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index f06933a..cc0c12e 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -3348,8 +3348,24 @@ BOOL WINAPI ClosePrinter(HANDLE hPrinter)
*/
BOOL WINAPI DeleteFormA(HANDLE hPrinter, LPSTR pFormName)
{
- FIXME("(%p,%s): stub\n", hPrinter, pFormName);
- return 1;
+ LPWSTR formnameW = NULL;
+ DWORD len;
+ BOOL res;
+
+ TRACE("(%p, %s)\n", hPrinter, pFormName);
+
+ if (pFormName) {
+ 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);
+ }
+ res = DeleteFormW(hPrinter, formnameW);
+ if (formnameW) HeapFree(GetProcessHeap(), 0, formnameW);
+ return res;
}
/*****************************************************************************
@@ -3357,8 +3373,31 @@ 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 (!pFormName) {
+ SetLastError(RPC_X_NULL_REF_POINTER);
+ 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.5.1
--------------030702030701020706070001--
More information about the wine-patches
mailing list