Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.7 KiB

  1. //
  2. // APITHK.C
  3. //
  4. // This file has API thunks that allow shdocvw to load and run on
  5. // multiple versions of NT or Win95. Since this component needs
  6. // to load on the base-level NT 4.0 and Win95, any calls to system
  7. // APIs introduced in later OS versions must be done via GetProcAddress.
  8. //
  9. // Also, any code that may need to access data structures that are
  10. // post-4.0 specific can be added here.
  11. //
  12. // NOTE: this file does *not* use the standard precompiled header,
  13. // so it can set _WIN32_WINNT to a later version.
  14. //
  15. #define UNICODE 1
  16. #include <shlwapi.h>
  17. #include <shlwapip.h>
  18. #include <resource.h>
  19. #include <shfusion.h>
  20. BOOL NT5_GetSaveFileNameW(LPOPENFILENAMEW pofn)
  21. {
  22. BOOL fRC = FALSE;
  23. if (GetUIVersion() >= 5)
  24. {
  25. // we're on Win2k or Millennium
  26. ULONG_PTR uCookie = 0;
  27. OPENFILENAMEW ofn_nt5;
  28. memset(&ofn_nt5, 0, sizeof(OPENFILENAMEW));
  29. CopyMemory(&ofn_nt5, pofn, pofn->lStructSize);
  30. ofn_nt5.lStructSize = sizeof(OPENFILENAMEW); // New OPENFILENAME struct size
  31. // If we start adding more of these, make a table.
  32. if(pofn->lpTemplateName == MAKEINTRESOURCE(IDD_ADDTOSAVE_DIALOG))
  33. ofn_nt5.lpTemplateName = MAKEINTRESOURCE(IDD_ADDTOSAVE_NT5_DIALOG);
  34. if (SHActivateContext(&uCookie))
  35. {
  36. fRC = GetSaveFileNameWrapW(&ofn_nt5);
  37. if (uCookie)
  38. {
  39. SHDeactivateContext(uCookie);
  40. }
  41. }
  42. if(fRC)
  43. {
  44. ofn_nt5.lStructSize = pofn->lStructSize; // restore old values
  45. ofn_nt5.lpTemplateName = pofn->lpTemplateName;
  46. CopyMemory(pofn, &ofn_nt5, pofn->lStructSize); // copy to passed in struct
  47. }
  48. }
  49. else
  50. {
  51. fRC = GetSaveFileNameWrapW(pofn);
  52. }
  53. return fRC;
  54. }
  55. PROPSHEETPAGE* Whistler_AllocatePropertySheetPage(int numPages, DWORD* pc)
  56. {
  57. PROPSHEETPAGE* pspArray = (PROPSHEETPAGE*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PROPSHEETPAGE)*numPages);
  58. if (pspArray)
  59. {
  60. int i;
  61. for (i=0; i<numPages; i++)
  62. {
  63. pspArray[i].dwSize = sizeof(PROPSHEETPAGE);
  64. pspArray[i].dwFlags = PSP_USEFUSIONCONTEXT;
  65. pspArray[i].hActCtx = g_hActCtx;
  66. }
  67. *pc = sizeof(PROPSHEETPAGE);
  68. }
  69. return pspArray;
  70. }
  71. HPROPSHEETPAGE Whistler_CreatePropertySheetPageW(LPCPROPSHEETPAGEW a)
  72. {
  73. LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)a;
  74. PROPSHEETPAGEW psp;
  75. if (g_hActCtx && (a->dwSize<=PROPSHEETPAGE_V2_SIZE))
  76. {
  77. memset(&psp, 0, sizeof(psp));
  78. CopyMemory(&psp, a, a->dwSize);
  79. psp.dwSize = sizeof(psp);
  80. ppsp = &psp;
  81. }
  82. return CreatePropertySheetPageW(ppsp);
  83. }