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.

61 lines
1.5 KiB

  1. //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  2. //
  3. // Copyright (c) 2001 Microsoft Corporation. All rights reserved.
  4. //
  5. // Module:
  6. // minifugurs.c
  7. //
  8. // Description:
  9. // Function to map fugu databases from resources
  10. //
  11. // Author:
  12. // hrowley
  13. //
  14. //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  15. #include "fugu.h"
  16. ///////////////////////////////////////
  17. //
  18. // FuguLoadRes
  19. //
  20. // Load an integer Fugu database from a resource
  21. //
  22. // Parameters:
  23. // pInfo: [out] Structure where information for unloading is stored
  24. // hInst: [in] Handle to the DLL containing the recognizer
  25. // iResNumber: [in] Number of the resource (ex RESID_FUGU)
  26. // iResType: [in] Number of the recognizer (ex VOLCANO_RES)
  27. // pLocRunInfo: [in] Locale database to check header on file
  28. //
  29. // Return values:
  30. // TRUE: Finished without errors
  31. // FALSE: An error occured
  32. //
  33. //////////////////////////////////////
  34. BOOL FuguLoadRes(
  35. FUGU_LOAD_INFO *pInfo,
  36. HINSTANCE hInst,
  37. int iResNumber,
  38. int iResType,
  39. LOCRUN_INFO *pLocRunInfo)
  40. {
  41. BYTE *pb;
  42. if (IsBadWritePtr(pInfo, sizeof(*pInfo)) ||
  43. IsBadReadPtr(pLocRunInfo, sizeof(*pLocRunInfo)) ||
  44. hInst == NULL)
  45. {
  46. return FALSE;
  47. }
  48. // Load the fugu database resource
  49. pb = DoLoadResource(&pInfo->info, hInst, iResNumber, iResType);
  50. if (!pb)
  51. {
  52. return FALSE;
  53. }
  54. // Check the format of the resource
  55. return FuguLoadPointer(pInfo, pLocRunInfo, pInfo->info.iSize);
  56. }