shell32 - ShellDDEInit

Dmitry Timoshkov dmitry at baikal.ru
Tue May 10 23:33:49 CDT 2005


"Steven Edwards" <steven_ed4153 at yahoo.com> wrote:

> The ReactOS guys are tired of seeing the fixme message.
> 
> Changelog:
> Implement ShellDDEInit
> 
> Index: lib/shell32/shell32_main.c
> ===================================================================
> --- lib/shell32/shell32_main.c  (revision 14808)
> +++ lib/shell32/shell32_main.c  (working copy)
> @@ -979,13 +979,66 @@
>      FIXME("%lx: stub\n",dw);
>  }
>  
> -
> +ATOM ProgmanAtom;
> +DWORD hDde;
> +UINT hProgmanTopic, hProgmanService, hStar, hShell, hAppProps, hFolders;
> +
>  /*************************************************************************
>   * ShellDDEInit (SHELL32.@)
>   */
> -void WINAPI ShellDDEInit(BOOL start)
> +void WINAPI ShellDDEInit(BOOL Start)
>  {
> -    FIXME("stub: %d\n", start);
> +    WCHAR wszSHELL_PROGMAN[] = {'P','R','O','G','M','A','N',0};
> +    WCHAR wszSHELL_TOPIC[] =  {'P','r','o','g','m','a','n',0};
> +    WCHAR wszSHELL_SERVICE[] = {'P','r','o','g','m','a','n',0};
> +    WCHAR wszSHELL_STAR[] = {'*',0};
> +    WCHAR wszSHELL_SHELL[] = {'S','h','e','l','l',0};
> +    WCHAR wszSHELL_APPPROPS[] = {'A','p','p','P','r','o','p', 'e', 'r', 't', 'i', 'e', 's',0};
> +    WCHAR wszSHELL_FOLDERS[] = {'F','o','l','d','e','r','s',0};
> +
> +    if (Start)
> +    {
> +        /* Create Atom */
> +        ProgmanAtom = GlobalAddAtomW(wszSHELL_PROGMAN);
> +
> +        /* Initialize DDE */
> +        DdeInitializeW(&hDde, NULL, CBF_FAIL_POKES | CBF_FAIL_ADVISES, 0L);
> +
> +        /* Register the Strings */
> +        hProgmanTopic = DdeCreateStringHandleW(hDde, wszSHELL_TOPIC, CP_WINUNICODE);
> +        hProgmanService = DdeCreateStringHandleW(hDde, wszSHELL_SERVICE, CP_WINUNICODE);
> +        hStar = DdeCreateStringHandleW(hDde, wszSHELL_STAR, CP_WINUNICODE);
> +        hShell = DdeCreateStringHandleW(hDde, wszSHELL_SHELL, CP_WINUNICODE);
> +        hAppProps = DdeCreateStringHandleW(hDde, wszSHELL_APPPROPS, CP_WINUNICODE);
> +        hFolders = DdeCreateStringHandleW(hDde, wszSHELL_FOLDERS, CP_WINUNICODE);
> +
> +        /* Register the Service Names */
> +        DdeNameService(hDde, hFolders, 0, DNS_REGISTER);
> +        DdeNameService(hDde, hProgmanService, 0, DNS_REGISTER);
> +        DdeNameService(hDde, hShell, 0, DNS_REGISTER);
> +    }
> +    else
> +    {
> +        /* Unregister the Service Names */
> +        DdeNameService(hDde, hFolders, 0, DNS_UNREGISTER);
> +        DdeNameService(hDde, hProgmanService, 0, DNS_UNREGISTER);
> +        DdeNameService(hDde, hShell, 0, DNS_UNREGISTER);
> +
> +        /* Free the Handles */
> +        DdeFreeStringHandle(hDde, hProgmanTopic);
> +        DdeFreeStringHandle(hDde, hProgmanService);
> +        DdeFreeStringHandle(hDde, hStar);
> +        DdeFreeStringHandle(hDde, hShell);
> +        DdeFreeStringHandle(hDde, hAppProps);
> +        DdeFreeStringHandle(hDde, hFolders);
> +
> +        /* Uninitialize DDE */
> +        DdeUninitialize(hDde);
> +        hDde = 0;
> +
> +        /* Delete the Atom */
> +        if (ProgmanAtom) ProgmanAtom = GlobalDeleteAtom(ProgmanAtom);
> +    }
>  }

If ReactOS guys could use 'static const' for unicode strings, make global
variables visible inside of the single source file static, check whether
DDE connection is being already [de]initialed and a little bit of error
checking that would be even better :-)

-- 
Dmitry.




More information about the wine-devel mailing list