hostfile_windows.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GRUB_EMU_HOSTFILE_H
  19. #define GRUB_EMU_HOSTFILE_H 1
  20. #include <config.h>
  21. #include <stdarg.h>
  22. #include <windows.h>
  23. typedef HANDLE grub_util_fd_t;
  24. #define GRUB_UTIL_FD_INVALID INVALID_HANDLE_VALUE
  25. #define GRUB_UTIL_FD_IS_VALID(x) ((x) != GRUB_UTIL_FD_INVALID)
  26. #define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 0
  27. #define DEFAULT_DIRECTORY "C:\\"GRUB_BOOT_DIR_NAME"\\"GRUB_DIR_NAME
  28. #define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
  29. struct grub_util_fd_dirent
  30. {
  31. char d_name[0];
  32. };
  33. struct grub_util_fd_dir;
  34. typedef struct grub_util_fd_dirent *grub_util_fd_dirent_t;
  35. typedef struct grub_util_fd_dir *grub_util_fd_dir_t;
  36. int
  37. grub_util_rename (const char *from, const char *to);
  38. int
  39. grub_util_unlink (const char *name);
  40. void
  41. grub_util_mkdir (const char *dir);
  42. grub_util_fd_dir_t
  43. grub_util_fd_opendir (const char *name);
  44. void
  45. grub_util_fd_closedir (grub_util_fd_dir_t dirp);
  46. grub_util_fd_dirent_t
  47. grub_util_fd_readdir (grub_util_fd_dir_t dirp);
  48. int
  49. grub_util_rmdir (const char *pathname);
  50. enum grub_util_fd_open_flags_t
  51. {
  52. GRUB_UTIL_FD_O_RDONLY = 1,
  53. GRUB_UTIL_FD_O_WRONLY = 2,
  54. GRUB_UTIL_FD_O_RDWR = 3,
  55. GRUB_UTIL_FD_O_CREATTRUNC = 4,
  56. GRUB_UTIL_FD_O_SYNC = 0,
  57. };
  58. #if defined (__MINGW32__) && !defined (__MINGW64__)
  59. /* 32 bit on Mingw-w64 already redefines them if _FILE_OFFSET_BITS=64 */
  60. #ifndef _W64
  61. #define fseeko fseeko64
  62. #define ftello ftello64
  63. #endif
  64. #endif
  65. LPTSTR
  66. grub_util_utf8_to_tchar (const char *in);
  67. char *
  68. grub_util_tchar_to_utf8 (LPCTSTR in);
  69. #endif