wusa.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright 2015 Michael Müller
  3. * Copyright 2015 Sebastian Lackner
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library 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 GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  18. */
  19. enum
  20. {
  21. ASSEMBLY_STATUS_NONE,
  22. ASSEMBLY_STATUS_IN_PROGRESS,
  23. ASSEMBLY_STATUS_INSTALLED,
  24. };
  25. struct assembly_identity
  26. {
  27. WCHAR *name;
  28. WCHAR *version;
  29. WCHAR *architecture;
  30. WCHAR *language;
  31. WCHAR *pubkey_token;
  32. };
  33. struct dependency_entry
  34. {
  35. struct list entry;
  36. struct assembly_identity identity;
  37. };
  38. struct fileop_entry
  39. {
  40. struct list entry;
  41. WCHAR *source;
  42. WCHAR *target;
  43. };
  44. struct registrykv_entry
  45. {
  46. struct list entry;
  47. WCHAR *name;
  48. WCHAR *value_type;
  49. WCHAR *value;
  50. };
  51. struct registryop_entry
  52. {
  53. struct list entry;
  54. WCHAR *key;
  55. struct list keyvalues;
  56. };
  57. struct assembly_entry
  58. {
  59. struct list entry;
  60. DWORD status;
  61. WCHAR *filename;
  62. WCHAR *displayname;
  63. struct assembly_identity identity;
  64. struct list dependencies;
  65. struct list fileops;
  66. struct list registryops;
  67. };
  68. void free_assembly(struct assembly_entry *entry) DECLSPEC_HIDDEN;
  69. void free_dependency(struct dependency_entry *entry) DECLSPEC_HIDDEN;
  70. struct assembly_entry *load_manifest(const WCHAR *filename) DECLSPEC_HIDDEN;
  71. BOOL load_update(const WCHAR *filename, struct list *update_list) DECLSPEC_HIDDEN;
  72. static inline char *strdupWtoA(const WCHAR *str)
  73. {
  74. char *ret = NULL;
  75. DWORD len;
  76. if (!str) return ret;
  77. len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
  78. if ((ret = malloc(len))) WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, NULL, NULL);
  79. return ret;
  80. }
  81. static inline WCHAR *strdupAtoW(const char *str)
  82. {
  83. WCHAR *ret = NULL;
  84. DWORD len;
  85. if (!str) return ret;
  86. len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
  87. if ((ret = malloc(len * sizeof(WCHAR)))) MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
  88. return ret;
  89. }
  90. static inline WCHAR *strdupW(const WCHAR *str)
  91. {
  92. WCHAR *ret;
  93. if (!str) return NULL;
  94. if ((ret = malloc((lstrlenW(str) + 1) * sizeof(WCHAR)))) lstrcpyW(ret, str);
  95. return ret;
  96. }
  97. static inline WCHAR *strdupWn(const WCHAR *str, DWORD len)
  98. {
  99. WCHAR *ret;
  100. if (!str) return NULL;
  101. if ((ret = malloc((len + 1) * sizeof(WCHAR))))
  102. {
  103. memcpy(ret, str, len * sizeof(WCHAR));
  104. ret[len] = 0;
  105. }
  106. return ret;
  107. }