wbemprox: Implement StdRegProv.CreateKey.
[wine.git] / dlls / opcservices / opc_private.h
blobc7b1d0cab3d84669ae7dfcf84ca284fb90d8830f
1 /*
2 * Copyright 2018 Nikolay Sivov for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "msopc.h"
20 #include "wine/heap.h"
22 static inline BOOL opc_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
24 size_t new_capacity, max_capacity;
25 void *new_elements;
27 if (count <= *capacity)
28 return TRUE;
30 max_capacity = ~(SIZE_T)0 / size;
31 if (count > max_capacity)
32 return FALSE;
34 new_capacity = max(4, *capacity);
35 while (new_capacity < count && new_capacity <= max_capacity / 2)
36 new_capacity *= 2;
37 if (new_capacity < count)
38 new_capacity = max_capacity;
40 if (!(new_elements = heap_realloc(*elements, new_capacity * size)))
41 return FALSE;
43 *elements = new_elements;
44 *capacity = new_capacity;
45 return TRUE;
48 struct opc_uri
50 IOpcPartUri IOpcPartUri_iface;
51 LONG refcount;
52 BOOL is_part_uri;
54 IUri *uri;
55 IUri *rels_part_uri;
56 struct opc_uri *source_uri;
59 extern HRESULT opc_package_create(IOpcFactory *factory, IOpcPackage **package) DECLSPEC_HIDDEN;
60 extern HRESULT opc_part_uri_create(IUri *uri, struct opc_uri *source_uri, IOpcPartUri **part_uri) DECLSPEC_HIDDEN;
61 extern HRESULT opc_root_uri_create(IOpcUri **opc_uri) DECLSPEC_HIDDEN;
63 extern HRESULT opc_package_write(IOpcPackage *package, OPC_WRITE_FLAGS flags, IStream *stream) DECLSPEC_HIDDEN;
65 struct zip_archive;
66 extern HRESULT compress_create_archive(IStream *output, struct zip_archive **archive) DECLSPEC_HIDDEN;
67 extern HRESULT compress_add_file(struct zip_archive *archive, const WCHAR *path, IStream *content,
68 OPC_COMPRESSION_OPTIONS options) DECLSPEC_HIDDEN;
69 extern void compress_finalize_archive(struct zip_archive *archive) DECLSPEC_HIDDEN;