From: C-o-r-E Date: Tue, 14 Aug 2012 16:31:52 +0000 (-0400) Subject: wfreerdp-server: modified and documented the attatchtodesktop function X-Git-Tag: 1.1.0-beta1~220^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ceb218a3cf5fab37b47915cb2ed2a777f83f2921;p=platform%2Fupstream%2Ffreerdp.git wfreerdp-server: modified and documented the attatchtodesktop function --- diff --git a/server/Windows/wf_mirage.c b/server/Windows/wf_mirage.c index 0555084..fd04cf3 100644 --- a/server/Windows/wf_mirage.c +++ b/server/Windows/wf_mirage.c @@ -75,7 +75,16 @@ BOOL wf_check_disp_devices(wfPeerContext* context) return false; } -int wf_mirage_step2(wfPeerContext* context) +/* +This function will attempt to access the the windows registry using the device + key stored in the current context. It will attempt to read the value of the + "Attach.ToDesktop" subkey and will return true if the value is already set to + val. If unable to read the subkey, this function will return false. If the + subkey is not set to val it will then attempt to set it to val and return true. If + unsuccessful or an unexpected value is encountered, the function returns + false. + */ +BOOL wf_disp_device_set_attatch(wfPeerContext* context, DWORD val) { LONG status; DWORD rtype, rdata, rdata_size; @@ -93,38 +102,38 @@ int wf_mirage_step2(wfPeerContext* context) { printf("Failed to read registry value.\n"); printf("operation returned %d\n", status); - return -1; + return false; } _tprintf(_T("type = %04X, data = %04X\n\nNow let's try attaching it...\n"), rtype, rdata); - if (rdata == 0) + if (rdata == val ^ 1) { - rdata = 1; + rdata = val; status = RegSetKeyValue(HKEY_LOCAL_MACHINE, context->deviceKey, _T("Attach.ToDesktop"), REG_DWORD, &rdata, rdata_size); if (status != ERROR_SUCCESS) { - _tprintf(_T("Failed to read registry value.\n")); + _tprintf(_T("Failed to write registry value.\n")); _tprintf(_T("operation returned %d\n"), status); - return -1; + return false; } - _tprintf(_T("Attached to Desktop\n\n")); + _tprintf(_T("Wrote subkey \"Attach.ToDesktop\" -> %04X\n\n", rdata)); } - else if (rdata == 1) + else if (rdata == val) { - _tprintf(_T("Already attached to desktop!\n")); + _tprintf(_T("\"Attach.ToDesktop\" is already set to %04X!\n", rdata)); } else { - _tprintf(_T("Something went wrong with attaching to desktop...\nrdata=%d\n"), rdata); - return -1; + _tprintf(_T("An wild value appeared!...\nrdata=%d\n"), rdata); + return false; } - return 0; + return true; } int wf_mirage_step3(wfPeerContext* context) diff --git a/server/Windows/wf_mirage.h b/server/Windows/wf_mirage.h index 8f2f07c..5774f92 100644 --- a/server/Windows/wf_mirage.h +++ b/server/Windows/wf_mirage.h @@ -200,8 +200,8 @@ typedef struct ULONG nColorBmPalEntries; } Esc_dmf_pointer_shape_get_OUT; -int wf_check_disp_devices(wfPeerContext* context); -int wf_mirage_step2(wfPeerContext* context); +BOOL wf_check_disp_devices(wfPeerContext* context); +BOOL wf_disp_device_set_attatch(wfPeerContext* context, DWORD val); int wf_mirage_step3(wfPeerContext* context); int wf_mirage_step4(wfPeerContext* context);