Skip to content

Commit

Permalink
Sorted issue with _RemotableHandle struct in COM interop
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nelson <[email protected]>
  • Loading branch information
peterdn committed Aug 28, 2010
1 parent 92f5159 commit 31827b6
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 4 deletions.
2 changes: 1 addition & 1 deletion WebKitBrowser/PrintManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void _document_PrintPage(object sender, PrintPageEventArgs e)
}

_owner.Invoke(new MethodInvoker(delegate() {
_webFramePrivate.spoolPages(_hDC, _page, _page, 0);
_webFramePrivate.spoolPages(_hDC, _page, _page, IntPtr.Zero);
}));

++_page;
Expand Down
9 changes: 8 additions & 1 deletion WebKitBrowser/WebKitBrowser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<PlatformTarget>x86</PlatformTarget>
<DocumentationFile>
</DocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -39,6 +40,7 @@
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<DocumentationFile>..\bin\Release\WebKitBrowser.XML</DocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -112,6 +114,11 @@ echo gitignore &gt;&gt; temp_exclude_files.txt
xcopy /E /Y /EXCLUDE:temp_exclude_files.txt "$(SolutionDir)webkit\*" "$(SolutionDir)bin\$(ConfigurationName)"
del temp_exclude_files.txt</PostBuildEvent>
<PreBuildEvent>call "$(DevEnvDir)..\..\VC\vcvarsall.bat" x86
tlbimp "$(SolutionDir)webkit\webkit.tlb" /silent /keyfile:"$(ProjectDir)WebKit .NET.snk" /namespace:WebKit.Interop /out:"$(SolutionDir)webkit\WebKit.Interop.dll"</PreBuildEvent>
if not exist "$(SolutionDir)tools\TypeNormalizer.exe" csc /out:"$(SolutionDir)tools\TypeNormalizer.exe" "$(SolutionDir)tools\TypeNormalizer.cs"
tlbimp "$(SolutionDir)webkit\webkit.tlb" /silent /keyfile:"$(ProjectDir)WebKit .NET.snk" /namespace:WebKit.Interop /out:"$(SolutionDir)webkit\WebKit.Interop.dll"
ildasm "$(SolutionDir)webkit\WebKit.Interop.dll" /out="$(SolutionDir)webkit\temp_webkit_interop.il" /nobar
"$(SolutionDir)tools\TypeNormalizer.exe" "$(SolutionDir)webkit\temp_webkit_interop.il"
ilasm "$(SolutionDir)webkit\temp_webkit_interop.il" /dll /output="$(SolutionDir)webkit\WebKit.Interop.dll" /key="$(ProjectDir)WebKit .NET.snk"
del /F /Q "$(SolutionDir)webkit\temp_webkit_interop.*"</PreBuildEvent>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions WebKitBrowser/WebUIDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ public void mouseDidMoveOverElement(WebView sender, CFDictionaryPropertyBag elem
{
}

public void paintCustomScrollCorner(WebView WebView, ref _RemotableHandle hDC, tagRECT rect)
public void paintCustomScrollCorner(WebView WebView, int hDC, tagRECT rect)
{
}

public void paintCustomScrollbar(WebView WebView, ref _RemotableHandle hDC, tagRECT rect, WebScrollBarControlSize size, uint state, WebScrollbarControlPart pressedPart, int vertical, float value, float proportion, uint parts)
public void paintCustomScrollbar(WebView WebView, int hDC, tagRECT rect, WebScrollBarControlSize size, uint state, WebScrollbarControlPart pressedPart, int vertical, float value, float proportion, uint parts)
{
}

Expand Down
58 changes: 58 additions & 0 deletions tools/TypeNormalizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2009, Peter Nelson ([email protected])
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

/* TypeNormalizer.cs -- this tool is used during the WebKit .NET build
* process to replace references to _RemotableHandle with int32 in
* WebKit.Interop.dll. This is required as it appears that MIDL would prefer
* that we marshal values of type HDC to a reference to some undocumented
* _RemotableHandle structure, which doesn't appear to work correctly.
* Since an HDC on Win32 is simply a (void *), we can treat it as an int32
* here.
*
* TODO: Fix these to IntPtrs for 64-bit compat
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.IO;

class TypeNormalizer
{
static int Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("No file specified");
return 1;
}
string file = File.ReadAllText(args[0]);
file = file.Replace("valuetype WebKit.Interop._RemotableHandle&", "int32");
File.WriteAllText(args[0], file);
return 0;
}
}
Binary file modified webkit/JavaScriptCore.dll
Binary file not shown.
Binary file modified webkit/WebKit.dll
Binary file not shown.
Binary file modified webkit/WebKit.tlb
Binary file not shown.

0 comments on commit 31827b6

Please sign in to comment.