Hello,
Le 03/06/2013 16:51, JonY a écrit :> On 6/3/2013 22:18, Rafaël Carré wrote:
>
>> new file mode 100644
>> index 0000000..c49fc51
>> --- /dev/null
>> +++ b/mingw-w64-crt/lib32/runtimeobject.def
>> @@ -0,0 +1,25 @@
>> +LIBRARY "api-ms-win-core-winrt-string-l1-1-0.dll"
>
>
>> new file mode 100644
>> index 0000000..c211978
>> --- /dev/null
>> +++ b/mingw-w64-crt/lib64/runtimeobject.def
>> @@ -0,0 +1,29 @@
>> +LIBRARY "api-ms-win-core-winrt-string-l1-1-0.dll"
>>
>
> Are you sure about these? The library names do not match the DLL, these
> DLLs are internal versioned copies.
MSDN fails to mention runtimeobject.lib for Windows*String functions,
like it does for Ro* functions :
http://msdn.microsoft.com/en-us/library/br229855(v=vs.85).aspx , but
it's the right import lib. See for example last comment on
http://blogs.interknowlogy.com/2012/04/11/how-to-create-a-winrt-wrl-c-component-from-scratch-that-can-be-consumed-by-net-components/
However there is no runtimeobject.dll, the functions defined in this
import lib actually come from several DLLs, I confirmed this by building
a test exe with Visual Studio that uses Windows*String functions, and my
binary explicitely mentions this DLL.
i686-w64-mingw32-objdump -x extract:
There is an import table in .rdata at 0x438840
The Import Tables (interpreted .rdata section contents)
vma: Hint Time Forward DLL First
Table Stamp Chain Name Thunk
00038840 000388e0 00000000 00000000 00038b0e 0002f000
....
00038890 000389f0 00000000 00000000 00039a74 0002f110
DLL Name: api-ms-win-core-winrt-string-l1-1-0.dll
vma: Hint/Ord Member-Name Bound-To
399b8 7 WindowsCreateStringReference
3999c 12 WindowsGetStringRawBuffer
39a56 4 WindowsCompareStringOrdinal
39986 8 WindowsDeleteString
39a24 10 WindowsDuplicateString
39a0e 6 WindowsCreateString
39a3e 14 WindowsIsStringEmpty
000388a4 000389e4 00000000 00000000 00039a9c 0002f104
DLL Name: api-ms-win-core-winrt-l1-1-0.dll
vma: Hint/Ord Member-Name Bound-To
399d8 2 RoGetApartmentIdentifier
399f4 1 RoGetActivationFactory
Note, I'll add Ro* functions to this import lib in a forthcoming patch
(these functions are imported from a different DLL as seen above).
Le 03/06/2013 16:43, Kai Tietz a écrit :
> 2013/6/3 Rafaël Carré <fun...@videolan.org>:
>> diff --git a/mingw-w64-headers/include/winstring.h
>> b/mingw-w64-headers/include/winstring.h
>> new file mode 100644
>> index 0000000..b395cef
>> --- /dev/null
>> +++ b/mingw-w64-headers/include/winstring.h
>> @@ -0,0 +1,202 @@
>> +/**
>> + * This file has no copyright assigned and is placed in the Public Domain.
>> + * This file is part of the mingw-w64 runtime package.
>> + * No warranty is given; refer to the file DISCLAIMER.PD within this
>> package.
>> + */
>> +#ifndef __WINSTRING_H__
>> +#define __WINSTRING_H__
>> +
>> +#include <windows.h>
>> +#include <sdkddkver.h>
>
> Here we need to include additionally rpc.h header. Also we need here
> to include winapifamily.h.
I added rpc.h to winstring.h but I am not sure about winapifamily.h, as
these functions are available on both desktop and store apps.
> Also so some parts from this header should be put into hstring.h
> header AFAIC read, it seems to be an idl-based generated file, so
> this can come later ...
Oops I missed that header. HSTRING functions are all in winstring.h though.
>> +#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
> Hmm, true that API is Windows8 based, but do we really need to add
> here this guard ... anyway it won't hurt AFAICS.
If someone targets Windows 7 using this code it would build and link
properly but fail at runtime due to missing libs, so with this guard he
will get at least a compilation warning about missing prototypes.
>> +
>> +void __stdcall HSTRING_UserFree(
>> + unsigned long *pFlags,
>> + HSTRING *ppidl
>> +);
> Please write prototypes within one line. Also don't use __stdcall
> here. Better use __RPC_USER instead. All these HSTRING_... functions
> are RPC-stuff, so it should fit AFAICS. Write it like eg "void
> __RPC_USER HSTRING_UserFree(ULONG *pFlags, HSTRING *ppidl);'
Done.
New patch attached which leaves these questions:
- is winapifamily.h really needed?
- is rpc.h needed for hstring.h too?
Thanks,
>From 8a7237c5ba1dd4941e4671fd0ea7db3112ece451 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <fun...@videolan.org>
Date: Mon, 3 Jun 2013 16:12:35 +0200
Subject: [PATCH] Add winstring.h and corresponding runtimeobject imports
---
mingw-w64-crt/Makefile.am | 6 ++-
mingw-w64-crt/lib32/runtimeobject.def | 25 ++++++++++++
mingw-w64-crt/lib64/runtimeobject.def | 29 +++++++++++++
mingw-w64-headers/include/hstring.h | 37 +++++++++++++++++
mingw-w64-headers/include/winstring.h | 76 +++++++++++++++++++++++++++++++++++
5 files changed, 171 insertions(+), 2 deletions(-)
create mode 100644 mingw-w64-crt/lib32/runtimeobject.def
create mode 100644 mingw-w64-crt/lib64/runtimeobject.def
create mode 100644 mingw-w64-headers/include/hstring.h
create mode 100644 mingw-w64-headers/include/winstring.h
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 4ce1258..71c9f15 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -542,7 +542,8 @@ lib32_DATA = \
lib32/libxapofx.a lib32/libx3daudio.a lib32/libd3dx9.a \
lib32/libd3dx10.a lib32/libd3dx11.a lib32/libd3dcsxd.a \
lib32/libd3dcompiler.a lib32/libwinhttp.a lib32/libmsvcr110.a \
- lib32/libdevmgr.a lib32/libdevobj.a lib32/libdevrtl.a
+ lib32/libdevmgr.a lib32/libdevobj.a lib32/libdevrtl.a \
+ lib32/libruntimeobject.a
if ! W32API
lib32_DATA += lib32/libglut.a
@@ -1043,7 +1044,8 @@ lib64_DATA = \
lib64/libxinput.a lib64/libxaudio.a lib64/libxaudiod.a \
lib64/libxapofx.a lib64/libx3daudio.a lib64/libd3dx9.a \
lib64/libd3dx10.a lib64/libd3dx11.a lib64/libd3dcsxd.a \
- lib64/libd3dcompiler.a lib64/libwinhttp.a lib64/libmsvcr110.a
+ lib64/libd3dcompiler.a lib64/libwinhttp.a lib64/libmsvcr110.a \
+ lib64/libruntimeobject.a
lib64/libcrtdll.a lib64/libmsvcrt.a lib64/libmsvcr80.a: lib64/lib%.a: lib64/%.def
$(DTDEF64) $< --dllname $*.dll
diff --git a/mingw-w64-crt/lib32/runtimeobject.def b/mingw-w64-crt/lib32/runtimeobject.def
new file mode 100644
index 0000000..c49fc51
--- /dev/null
+++ b/mingw-w64-crt/lib32/runtimeobject.def
@@ -0,0 +1,25 @@
+LIBRARY "api-ms-win-core-winrt-string-l1-1-0.dll"
+EXPORTS
+HSTRING_UserFree@8
+HSTRING_UserMarshal@12
+HSTRING_UserSize@12
+HSTRING_UserUnmarshal@12
+WindowsCompareStringOrdinal@12
+WindowsConcatString@12
+WindowsCreateString@12
+WindowsCreateStringReference@16
+WindowsDeleteString@4
+WindowsDeleteStringBuffer@4
+WindowsDuplicateString@8
+WindowsGetStringLen@4
+WindowsGetStringRawBuffer@8
+WindowsInspectString@24
+WindowsIsStringEmpty@4
+WindowsPreallocateStringBuffer@12
+WindowsPromoteStringBuffer@8
+WindowsReplaceString@16
+WindowsStringHasEmbeddedNull@8
+WindowsSubstring@12
+WindowsSubstringWithSpecifiedLength@16
+WindowsTrimStringEnd@12
+WindowsTrimStringStart@12
diff --git a/mingw-w64-crt/lib64/runtimeobject.def b/mingw-w64-crt/lib64/runtimeobject.def
new file mode 100644
index 0000000..c211978
--- /dev/null
+++ b/mingw-w64-crt/lib64/runtimeobject.def
@@ -0,0 +1,29 @@
+LIBRARY "api-ms-win-core-winrt-string-l1-1-0.dll"
+EXPORTS
+HSTRING_UserFree
+HSTRING_UserFree64
+HSTRING_UserMarshal
+HSTRING_UserMarshal64
+HSTRING_UserSize
+HSTRING_UserSize64
+HSTRING_UserUnmarshal
+HSTRING_UserUnmarshal64
+WindowsCompareStringOrdinal
+WindowsConcatString
+WindowsCreateString
+WindowsCreateStringReference
+WindowsDeleteString
+WindowsDeleteStringBuffer
+WindowsDuplicateString
+WindowsGetStringLen
+WindowsGetStringRawBuffer
+WindowsInspectString
+WindowsIsStringEmpty
+WindowsPreallocateStringBuffer
+WindowsPromoteStringBuffer
+WindowsReplaceString
+WindowsStringHasEmbeddedNull
+WindowsSubstring
+WindowsSubstringWithSpecifiedLength
+WindowsTrimStringEnd
+WindowsTrimStringStart
diff --git a/mingw-w64-headers/include/hstring.h b/mingw-w64-headers/include/hstring.h
new file mode 100644
index 0000000..822c2e7
--- /dev/null
+++ b/mingw-w64-headers/include/hstring.h
@@ -0,0 +1,37 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#ifndef __HSTRING_H__
+#define __HSTRING_H__
+
+#include <windows.h>
+#include <sdkddkver.h>
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
+
+// Declaring a handle dummy struct for HSTRING the same way DECLARE_HANDLE does.
+typedef struct HSTRING__{
+ int unused;
+} HSTRING__;
+
+typedef HSTRING__* HSTRING;
+
+typedef HANDLE HSTRING_BUFFER;
+
+typedef struct HSTRING_HEADER {
+ union {
+ PVOID Reserved1;
+#if (_WIN64)
+ char Reserved2[24];
+#else
+ char Reserved2[20];
+#endif
+ } Reserved;
+} HSTRING_HEADER;
+
+/* */
+
+#endif
+#endif
diff --git a/mingw-w64-headers/include/winstring.h b/mingw-w64-headers/include/winstring.h
new file mode 100644
index 0000000..48f3473
--- /dev/null
+++ b/mingw-w64-headers/include/winstring.h
@@ -0,0 +1,76 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#ifndef __WINSTRING_H__
+#define __WINSTRING_H__
+
+#include <windows.h>
+#include <sdkddkver.h>
+#include <rpc.h>
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
+
+void __RPC_USER HSTRING_UserFree(unsigned long *pFlags, HSTRING *ppidl);
+
+unsigned char* __RPC_USER HSTRING_UserMarshal(unsigned long *pFlags, unsigned char *pBuffer, HSTRING *ppidl);
+
+unsigned long __RPC_USER HSTRING_UserSize(unsigned long *pFlags, unsigned long StartingSize, HSTRING *ppidl);
+
+unsigned char* __RPC_USER HSTRING_UserUnmarshal(unsigned long *pFlags, unsigned char *pBuffer, HSTRING *ppidl);
+
+#ifdef _WIN64
+void __RPC_USER HSTRING_UserFree64(unsigned long *pFlags, HSTRING *ppidl);
+
+unsigned char* __RPC_USER HSTRING_UserMarshal64(unsigned long *pFlags, unsigned char *pBuffer, HSTRING *ppidl);
+
+unsigned long __RPC_USER HSTRING_UserSize64(unsigned long *pFlags, unsigned long StartingSize, HSTRING *ppidl);
+
+unsigned char* __RPC_USER HSTRING_UserUnmarshal64(unsigned long *pFlags, unsigned char *pBuffer, HSTRING *ppidl);
+#endif
+
+/* */
+
+HRESULT WINAPI WindowsCompareStringOrdinal(HSTRING string1, HSTRING string2, INT32 *result);
+
+HRESULT WINAPI WindowsConcatString(HSTRING string1, HSTRING string2, HSTRING *newString);
+
+HRESULT WINAPI WindowsCreateString(LPCWSTR sourceString, UINT32 length, HSTRING *string);
+
+HRESULT WINAPI WindowsCreateStringReference(PCWSTR sourceString, UINT32 length, HSTRING_HEADER *hstringHeader, HSTRING *string);
+
+HRESULT WINAPI WindowsDeleteString(HSTRING string);
+
+HRESULT WindowsDeleteStringBuffer(HSTRING_BUFFER bufferHandle);
+
+HRESULT WINAPI WindowsDuplicateString(HSTRING string, HSTRING *newString);
+
+UINT32 WINAPI WindowsGetStringLen(HSTRING string);
+
+PCWSTR WINAPI WindowsGetStringRawBuffer(HSTRING string, UINT32 *length);
+
+typedef HRESULT (WINAPI *PINSPECT_HSTRING_CALLBACK)(void *context, UINT_PTR readAddress, UINT32 length, BYTE *buffer);
+
+HRESULT WINAPI WindowsInspectString(UINT_PTR targetHString, USHORT machine, PINSPECT_HSTRING_CALLBACK callback, void *context, UINT32 *length, UINT_PTR *targetStringAddress);
+
+BOOL WINAPI WindowsIsStringEmpty(HSTRING string);
+
+HRESULT WindowsPreallocateStringBuffer(UINT32 length, WCHAR **mutableBuffer, HSTRING_BUFFER *bufferHandle);
+
+HRESULT WindowsPromoteStringBuffer(HSTRING_BUFFER bufferHandle, HSTRING *string);
+
+HRESULT WINAPI WindowsReplaceString(HSTRING string, HSTRING stringReplaced, HSTRING stringReplaceWith, HSTRING *newString);
+
+HRESULT WINAPI WindowsStringHasEmbeddedNull(HSTRING string, BOOL *hasEmbedNull);
+
+HRESULT WINAPI WindowsSubstring(HSTRING string, UINT32 startIndex, HSTRING *newString);
+
+HRESULT WINAPI WindowsSubstringWithSpecifiedLength(HSTRING string, UINT32 startIndex, UINT32 length, HSTRING *newString);
+
+HRESULT WINAPI WindowsTrimStringEnd(HSTRING string, HSTRING trimString, HSTRING *newString);
+
+HRESULT WINAPI WindowsTrimStringStart(HSTRING string, HSTRING trimString, HSTRING *newString);
+
+#endif
+#endif
--
1.8.1.2
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public