仿真平台内核初版 -tlib库 包含<sparc arm riscv powerPC>

This commit is contained in:
liuwb
2026-02-07 20:43:43 +08:00
parent de61f9e2b0
commit b3117648be
9748 changed files with 4309137 additions and 0 deletions

View File

@@ -0,0 +1,194 @@
//
// IDocHostUIHandler.cs
//
// Author:
// Vsevolod Kukol <sevo@sevo.org>
//
// Copyright (c) 2016 (c) Vsevolod Kukol
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
namespace Xwt.NativeMSHTML
{
enum DOCHOSTUIDBLCLK : uint
{
DOCHOSTUIDBLCLK_DEFAULT = 0,
DOCHOSTUIDBLCLK_SHOWPROPERTIES = 1,
DOCHOSTUIDBLCLK_SHOWCODE = 2
}
[Flags]
enum DOCHOSTUIFLAG : uint
{
DOCHOSTUIFLAG_DIALOG = 0x00000001,
DOCHOSTUIFLAG_DISABLE_HELP_MENU = 0x00000002,
DOCHOSTUIFLAG_NO3DBORDER = 0x00000004,
DOCHOSTUIFLAG_SCROLL_NO = 0x00000008,
DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE = 0x00000010,
DOCHOSTUIFLAG_OPENNEWWIN = 0x00000020,
DOCHOSTUIFLAG_DISABLE_OFFSCREEN = 0x00000040,
DOCHOSTUIFLAG_FLAT_SCROLLBAR = 0x00000080,
DOCHOSTUIFLAG_DIV_BLOCKDEFAULT = 0x00000100,
DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY = 0x00000200,
DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY = 0x00000400,
DOCHOSTUIFLAG_CODEPAGELINKEDFONTS = 0x00000800,
DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 = 0x00001000,
DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 = 0x00002000,
DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE = 0x00004000,
DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION = 0x00010000,
DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION = 0x00020000,
DOCHOSTUIFLAG_THEME = 0x00040000,
DOCHOSTUIFLAG_NOTHEME = 0x00080000,
DOCHOSTUIFLAG_NOPICS = 0x00100000,
DOCHOSTUIFLAG_NO3DOUTERBORDER = 0x00200000,
DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP = 0x00400000,
DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK = 0x00800000,
DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL = 0x01000000,
DOCHOSTUIFLAG_HOST_NAVIGATES = 0x02000000,
DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION = 0x04000000,
DOCHOSTUIFLAG_USE_WINDOWLESS_SELECTCONTROL = 0x08000000,
DOCHOSTUIFLAG_USE_WINDOWED_SELECTCONTROL = 0x10000000,
DOCHOSTUIFLAG_ENABLE_ACTIVEX_INACTIVATE_MODE = 0x20000000,
DOCHOSTUIFLAG_DPI_AWARE = 0x40000000
}
enum DOCHOSTUICONTEXTMENU : uint
{
CONTEXT_MENU_DEFAULT = 0,
CONTEXT_MENU_IMAGE = 1,
CONTEXT_MENU_CONTROL = 2,
CONTEXT_MENU_TABLE = 3,
CONTEXT_MENU_TEXTSELECT = 4,
CONTEXT_MENU_ANCHOR = 5,
CONTEXT_MENU_UNKNOWN = 6,
CONTEXT_MENU_IMGDYNSRC = 7,
CONTEXT_MENU_DEBUG = 8,
CONTEXT_MENU_VSCROLL = 9,
CONTEXT_MENU_HSCROLL = 10,
CONTEXT_MENU_MEDIA = 11
}
[StructLayout (LayoutKind.Sequential)]
struct DOCHOSTUIINFO
{
[MarshalAs (UnmanagedType.U4)]
public uint cbSize;
[MarshalAs (UnmanagedType.U4)]
public DOCHOSTUIFLAG dwFlags;
[MarshalAs (UnmanagedType.U4)]
public DOCHOSTUIDBLCLK dwDoubleClick;
[MarshalAs (UnmanagedType.LPWStr)]
public string pchHostCss;
[MarshalAs (UnmanagedType.LPWStr)]
public string pchHostNS;
}
[StructLayout (LayoutKind.Sequential)]
struct MSG
{
public IntPtr hwnd;
public uint message;
public UIntPtr wParam;
public IntPtr lParam;
public uint time;
public POINT pt;
}
[StructLayout (LayoutKind.Sequential)]
struct RECT
{
public IntPtr left;
public IntPtr top;
public IntPtr right;
public IntPtr bottom;
}
[StructLayout (LayoutKind.Sequential)]
struct POINT
{
public IntPtr x;
public IntPtr y;
}
[ComImport, Guid ("3050F3F0-98B5-11CF-BB82-00AA00BDCE0B"), InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
interface ICustomDoc
{
[PreserveSig]
int SetUIHandler (IDocHostUIHandler pUIHandler);
}
[ComImport, Guid ("BD3F23C0-D43E-11CF-893B-00AA00BDCE1A"), InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
interface IDocHostUIHandler
{
[PreserveSig]
[return: MarshalAs(UnmanagedType.Error)]
int ShowContextMenu (
[MarshalAs(UnmanagedType.U4)] DOCHOSTUICONTEXTMENU dwID,
ref POINT ppt,
[MarshalAs(UnmanagedType.IUnknown)] object pcmdtReserved,
[MarshalAs(UnmanagedType.IDispatch)] object pdispReserved
);
void GetHostInfo (ref DOCHOSTUIINFO pInfo);
void ShowUI (uint dwID, ref object pActiveObject, ref object pCommandTarget, ref object pFrame, ref object pDoc);
void HideUI ();
void UpdateUI ();
void EnableModeless ([In, MarshalAs(UnmanagedType.Bool)] bool fEnable);
void OnDocWindowActivate ([In, MarshalAs(UnmanagedType.Bool)] bool fActivate);
void OnFrameWindowActivate ([In, MarshalAs(UnmanagedType.Bool)] bool fActivate);
void ResizeBorder (ref RECT prcBorder, object pUIWindow, [In, MarshalAs (UnmanagedType.Bool)] bool fFrameWindow);
[PreserveSig]
[return: MarshalAs (UnmanagedType.Error)]
int TranslateAccelerator (ref MSG lpMsg, ref Guid pguidCmdGroup, uint nCmdID);
void GetOptionKeyPath ([MarshalAs(UnmanagedType.BStr)] out string pchKey, uint dw);
[PreserveSig]
[return: MarshalAs (UnmanagedType.Error)]
int GetDropTarget (
[In, MarshalAs (UnmanagedType.Interface)] object pDropTarget,
[Out, MarshalAs (UnmanagedType.Interface)] out object ppDropTarget
);
void GetExternal ([MarshalAs (UnmanagedType.IDispatch)] out object ppDispatch);
[PreserveSig]
[return: MarshalAs (UnmanagedType.Error)]
int TranslateUrl (
uint dwTranslate,
[MarshalAs (UnmanagedType.BStr)] string pchURLIn,
[MarshalAs (UnmanagedType.BStr)] out string ppchURLOut
);
[PreserveSig]
[return: MarshalAs (UnmanagedType.Error)]
int FilterDataObject (IDataObject pDO, out IDataObject pDOppDORet);
}
}

View File

@@ -0,0 +1,83 @@
//
// NativeMethods.cs
//
// Author:
// Eric Maupin <ermau@xamarin.com>
//
// Copyright (c) 2012 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
namespace Xwt.WPFBackend.Interop
{
enum HResult
{
S_OK = 0x00000000,
S_FALSE = 0x00000001,
}
internal static class NativeMethods
{
[StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
struct StockIconInfo
{
internal uint StructureSize;
internal IntPtr Handle;
internal int ImageIndex;
internal int Indentifier;
[MarshalAs (UnmanagedType.ByValTStr, SizeConst = 260)]
internal string Path;
}
[DllImport ("Shell32.dll", CharSet = CharSet.Unicode)]
static extern int SHGetStockIconInfo (NativeStockIcon icon, NativeStockIconOptions options,
ref StockIconInfo info);
[DllImport ("User32.dll", SetLastError = true)]
static extern bool DestroyIcon (IntPtr handle);
internal static BitmapSource GetImage (NativeStockIcon icon, NativeStockIconOptions options)
{
options |= NativeStockIconOptions.Handle;
StockIconInfo info = new StockIconInfo();
info.StructureSize = (uint) Marshal.SizeOf (typeof (StockIconInfo));
int hresult = SHGetStockIconInfo (icon, options, ref info);
if (hresult < 0)
throw new COMException ("SHGetStockIconInfo failed", hresult);
BitmapSource bitmap;
try {
bitmap = Imaging.CreateBitmapSourceFromHIcon (info.Handle, Int32Rect.Empty, null);
}
finally {
DestroyIcon (info.Handle);
}
return bitmap;
}
}
}

View File

@@ -0,0 +1,128 @@
//
// NativeStockIcon.cs
//
// Author:
// Eric Maupin <ermau@xamarin.com>
//
// Copyright (c) 2012 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Xwt.WPFBackend.Interop
{
[Flags]
internal enum NativeStockIconOptions : uint {
Large = 0x000000000,
Small = 0x000000001,
ShellSize = 0x000000004,
Handle = 0x000000100,
SystemIndex = 0x000004000,
LinkOverlay = 0x000008000,
Selected = 0x000010000
}
internal enum NativeStockIcon : uint {
DocumentNotAssociated = 0,
DocumentAssociated = 1,
Application = 2,
Folder = 3,
FolderOpen = 4,
Drive525 = 5,
Drive35 = 6,
DriveRemove = 7,
DriveFixed = 8,
DriveNetwork = 9,
DriveNetworkDisabled = 10,
DriveCD = 11,
DriveRAM = 12,
World = 13,
Server = 15,
Printer = 16,
MyNetwork = 17,
Find = 22,
Help = 23,
Share = 28,
Link = 29,
SlowFile = 30,
Recycler = 31,
RecyclerFull = 32,
MediaCDAudio = 40,
Lock = 47,
AutoList = 49,
PrinterNet = 50,
ServerShare = 51,
PrinterFax = 52,
PrinterFaxNet = 53,
PrinterFile = 54,
Stack = 55,
MediaSVCD = 56,
StuffedFolder = 57,
DriveUnknown = 58,
DriveDVD = 59,
MediaDVD = 60,
MediaDVDRAM = 61,
MediaDVDRW = 62,
MediaDVDR = 63,
MediaDVDROM = 64,
MediaCDAudioPlus = 65,
MediaCDRW = 66,
MediaCDR = 67,
MediaCDBurn = 68,
MediaBlankCD = 69,
MediaCDROM = 70,
AudioFiles = 71,
ImageFiles = 72,
VideoFiles = 73,
MixedFiles = 74,
FolderBack = 75,
FolderFront = 76,
Shield = 77,
Warning = 78,
Info = 79,
Error = 80,
Key = 81,
Software = 82,
Rename = 83,
Delete = 84,
MediaAudioDVD = 85,
MediaMovieDVD = 86,
MediaEnhancedCD = 87,
MediaEnhancedDVD = 88,
MediaHDDVD = 89,
MediaBluRay = 90,
MediaVCD = 91,
MediaDVDPlusR = 92,
MediaDVDPlusRW = 93,
DesktopPC = 94,
MobilePC = 95,
Users = 96,
MediaSmartMedia = 97,
MediaCompactFlash = 98,
DeviceCellPhone = 99,
DeviceCamera = 100,
DeviceVideoCamera = 101,
DeviceAudioPlayer = 102,
NetworkConnect = 103,
Internet = 104,
ZipFile = 105,
Settings = 106
}
}