callback.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * Help Viewer - DLL callback into WineHelp
  3. *
  4. * Copyright 2004 Eric Pouech
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  19. */
  20. #define WIN32_LEAN_AND_MEAN
  21. #include <stdio.h>
  22. #include "windows.h"
  23. #include "winhelp.h"
  24. #include "wine/debug.h"
  25. WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
  26. static WORD CALLBACK WHD_GetFSError(void)
  27. {
  28. WINE_FIXME("()\n");
  29. return 0;
  30. }
  31. static HANDLE CALLBACK WHD_Open(LPSTR name, BYTE flags)
  32. {
  33. unsigned mode = 0;
  34. WINE_FIXME("(%s %x)\n", debugstr_a(name), flags);
  35. switch (flags)
  36. {
  37. case 0: mode = GENERIC_READ | GENERIC_WRITE; break;
  38. case 2: mode = GENERIC_READ; break;
  39. default: WINE_FIXME("Undocumented flags %x\n", flags);
  40. }
  41. return CreateFileA(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
  42. OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  43. }
  44. static WORD CALLBACK WHD_Close(HANDLE fs)
  45. {
  46. WINE_FIXME("(%p)\n", fs);
  47. CloseHandle(fs);
  48. return 0;
  49. }
  50. static HANDLE CALLBACK WHD_OpenBag(HANDLE fs, LPSTR name, BYTE flags)
  51. {
  52. WINE_FIXME("(%p %s %x)\n", fs, debugstr_a(name), flags);
  53. return NULL;
  54. }
  55. static HANDLE CALLBACK WHD_CloseBag(HANDLE bag)
  56. {
  57. WINE_FIXME("()\n");
  58. return NULL;
  59. }
  60. static LONG CALLBACK WHD_ReadBag(HANDLE bag, BYTE* ptr, LONG len)
  61. {
  62. WINE_FIXME("()\n");
  63. return 0;
  64. }
  65. static LONG CALLBACK WHD_TellBag(HANDLE bag)
  66. {
  67. WINE_FIXME("()\n");
  68. return 0;
  69. }
  70. static LONG CALLBACK WHD_SeekBag(HANDLE bag, LONG offset, WORD whence)
  71. {
  72. WINE_FIXME("()\n");
  73. return 0;
  74. }
  75. static BOOL CALLBACK WHD_IsEofBag(HANDLE bag)
  76. {
  77. WINE_FIXME("()\n");
  78. return FALSE;
  79. }
  80. static LONG CALLBACK WHD_SizeBag(HANDLE bag)
  81. {
  82. WINE_FIXME("()\n");
  83. return 0;
  84. }
  85. static BOOL CALLBACK WHD_Access(HANDLE fs, LPSTR name, BYTE flags)
  86. {
  87. WINE_FIXME("()\n");
  88. return FALSE;
  89. }
  90. static WORD CALLBACK WHD_LLInfoFromBag(HANDLE bag, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
  91. {
  92. WINE_FIXME("()\n");
  93. return 0;
  94. }
  95. static WORD CALLBACK WHD_LLInfoFromFile(HANDLE fs, LPSTR name, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
  96. {
  97. WINE_FIXME("()\n");
  98. return 0;
  99. }
  100. static void CALLBACK WHD_Error(int err)
  101. {
  102. WINE_FIXME("()\n");
  103. }
  104. static void CALLBACK WHD_ErrorString(LPSTR err)
  105. {
  106. WINE_FIXME("()\n");
  107. }
  108. static ULONG_PTR CALLBACK WHD_GetInfo(WORD what, HWND hnd)
  109. {
  110. ULONG_PTR ret = 0;
  111. WINE_TRACE("(%x %p)\n", what, hnd);
  112. switch (what)
  113. {
  114. case 0: break;
  115. case 1: /* instance */ ret = (ULONG_PTR)Globals.hInstance; break;
  116. case 3: /* current window */ ret = (ULONG_PTR)Globals.active_win->hMainWnd; break;
  117. case 2: /* main window */
  118. case 4: /* handle to opened file */
  119. case 5: /* foreground color */
  120. case 6: /* background color */
  121. case 7: /* topic number */
  122. case 8: /* current opened file name */
  123. WINE_FIXME("NIY %u\n", what);
  124. break;
  125. default:
  126. WINE_FIXME("Undocumented %u\n", what);
  127. break;
  128. }
  129. return ret;
  130. }
  131. static LONG CALLBACK WHD_API(LPSTR x, WORD xx, DWORD xxx)
  132. {
  133. WINE_FIXME("()\n");
  134. return 0;
  135. }
  136. const struct winhelp_callbacks Callbacks =
  137. {
  138. WHD_GetFSError,
  139. WHD_Open,
  140. WHD_Close,
  141. WHD_OpenBag,
  142. WHD_CloseBag,
  143. WHD_ReadBag,
  144. WHD_TellBag,
  145. WHD_SeekBag,
  146. WHD_IsEofBag,
  147. WHD_SizeBag,
  148. WHD_Access,
  149. WHD_LLInfoFromBag,
  150. WHD_LLInfoFromFile,
  151. WHD_Error,
  152. WHD_ErrorString,
  153. WHD_GetInfo,
  154. WHD_API
  155. };