⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unifiedkernel-0.2.0-w0.9.11.diff

📁 该项目主要是将wingdows程序直接运行在linux上
💻 DIFF
📖 第 1 页 / 共 5 页
字号:
+	if ((params)) \+	{ \+		NORMALIZE((params)->CurrentDirectory.DosPath.Buffer, (params)); \+		NORMALIZE((params)->DllPath.Buffer, (params)); \+		NORMALIZE((params)->ImagePathName.Buffer, (params)); \+		NORMALIZE((params)->CommandLine.Buffer, (params)); \+		NORMALIZE((params)->WindowTitle.Buffer, (params)); \+		NORMALIZE((params)->Desktop.Buffer, (params)); \+		NORMALIZE((params)->ShellInfo.Buffer, (params)); \+		NORMALIZE((params)->RuntimeInfo.Buffer, (params)); \+	} \+}++void init_for_load()+{+	WINE_MODREF *wm;+	PEB *peb = NtCurrentTeb()->Peb;+    	RTL_USER_PROCESS_PARAMETERS *params = peb->ProcessParameters;+	WCHAR *fullname;+	IMAGE_NT_HEADERS *nt = RtlImageNtHeader(peb->ImageBaseAddress);+	struct ntdll_thread_data *thread_data; +	struct ntdll_thread_regs *thread_regs; +	+	if ((unsigned long)params->CommandLine.Buffer < (unsigned long)params)+	{+		NORMALIZE((params)->CurrentDirectory.DosPath.Buffer, (params));+		NORMALIZE((params)->DllPath.Buffer, (params));+		NORMALIZE((params)->ImagePathName.Buffer, (params));+		NORMALIZE((params)->CommandLine.Buffer, (params));+		NORMALIZE((params)->WindowTitle.Buffer, (params));+		NORMALIZE((params)->Desktop.Buffer, (params));+		NORMALIZE((params)->ShellInfo.Buffer, (params));+		NORMALIZE((params)->RuntimeInfo.Buffer, (params));+	}++	/* signal */+	thread_data = (struct ntdll_thread_data *)NtCurrentTeb()->SystemReserved2;+	thread_regs = (struct ntdll_thread_regs *)NtCurrentTeb()->SpareBytes1;++	thread_regs->fs = 0;+	asm("mov %%fs, %0\n" : "=m"(thread_regs->fs));+    +	get_signal_stack_total_size();+	+	/* debug initialization for debug log*/+	__debug_init();+	+	/* initialize module lists */+	InitializeListHead(&ldr.InLoadOrderModuleList);+	InitializeListHead(&ldr.InMemoryOrderModuleList);+	InitializeListHead(&ldr.InInitializationOrderModuleList);+	NtCurrentTeb()->Peb->LdrData = &ldr;+	+	/* initialize some fields in teb and peb */+	NtCurrentTeb()->StaticUnicodeString.Length        = 0;+	NtCurrentTeb()->StaticUnicodeString.Buffer        = NtCurrentTeb()->StaticUnicodeBuffer;+	NtCurrentTeb()->StaticUnicodeString.MaximumLength = sizeof(NtCurrentTeb()->StaticUnicodeBuffer);++	peb->TlsBitmap          = &_tls_bitmap;+	peb->TlsExpansionBitmap = &_tls_expansion_bitmap;+	RtlInitializeBitMap(&_tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8);+	RtlInitializeBitMap(&_tls_expansion_bitmap, peb->TlsExpansionBitmapBits,+			sizeof(peb->TlsExpansionBitmapBits) * 8);+	+	InitializeListHead( &tls_links );+	InsertHeadList( &tls_links, &(NtCurrentTeb()->TlsLinks) );+	+	/* preset codepages before kernel32 being loaded */+	__wine_init_codepages(wine_cp_get_table(1252),+			wine_cp_get_table(437),+			wine_cp_get_table(28591));++	/* connect to the server */+	server_init_process();+	server_init_thread(getpid(), -1, NULL);/* FIXME: it needs implementing to comfirm tid */++	/* create process heap */+	if (!(peb->ProcessHeap = RtlCreateHeap(HEAP_GROWABLE, NULL, 0, 0, NULL, NULL))) {+		ERR("Error in create heap\n");+		exit(1);+	}+	+	/* create view for main exe sections */+	if (create_pe_sec_view(peb->ImageBaseAddress)) {+		ERR("Error in create pe sections' views\n");+		exit(1);+	}++	/* allocate a module for main exe */+	if (!(fullname = get_native_fullname(&params->CurrentDirectory.DosPath,+					&params->ImagePathName))) {+		ERR( "can't load %s\n", debugstr_w(params->ImagePathName.Buffer));+		exit(1);+	}++	wm = alloc_module(peb->ImageBaseAddress, fullname);+	RtlFreeHeap(GetProcessHeap(), 0, fullname);+	if (!wm) {+		ERR( "can't load %s\n", debugstr_w(fullname));+		exit(1);+	}++	/* register main exe on wine server */+	+	SERVER_START_REQ(load_dll)+	{+		req->handle     = 0; /* no handle of main exe */+		req->base       = peb->ImageBaseAddress;+		req->size       = nt->OptionalHeader.SizeOfImage;+		req->dbg_offset = nt->FileHeader.PointerToSymbolTable;+		req->dbg_size   = nt->FileHeader.NumberOfSymbols;+		req->name       = &wm->ldr.FullDllName.Buffer;+		wine_server_add_data(req, wm->ldr.FullDllName.Buffer, wm->ldr.FullDllName.Length);+		wine_server_call(req);+	}+	SERVER_END_REQ;+}++__attribute__((stdcall))+int PrepareThunk(+			int argc,+			char **argv,+			void (*init) (void),+			void (*rtld_fini)(void))+{+	char	**evp;+	char 	*wine_path, *bin_dir;+	char	wine[] = "/wine";++	if (__builtin_expect (rtld_fini != NULL, 1))+		__cxa_atexit ((void (*) (void *)) rtld_fini, NULL, NULL);++	evp = argv + argc + 1;+	+	bin_dir = get_wine_bindir();+	wine_path = malloc(strlen(bin_dir) + sizeof(wine));+	strcpy(wine_path, bin_dir);+	strcat(wine_path, wine);+	free(bin_dir);++	wine_init_argv0_path(wine_path);+	build_dll_path();+	__wine_main_argc = argc;+	__wine_main_argv = argv;+	__wine_main_environ = evp;+	free(wine_path);++	init_for_load();++#if 0+	while (*evp++)+		;++	auxvec = (ElfW(auxv_t) *)evp;+	for (av = auxvec;av->a_type != AT_NULL;++av)+		if (av->a_type == AT_BAK) {+			result = (int)av->a_un.a_val;+			break;+		}+#endif++	/* Call the initializer of the program, if any.  */+	if (init)+		(*init)();++	/* .init in ntdll.dll.so */+	_init();+	return extra_page;+}+#endifdiff -Nru wine-0.9.11.ori/dlls/ntdll/ld.s wine-0.9.11/dlls/ntdll/ld.s--- wine-0.9.11.ori/dlls/ntdll/ld.s	1970-01-01 08:00:00.000000000 +0800+++ wine-0.9.11/dlls/ntdll/ld.s	2007-03-23 09:53:02.000000000 +0800@@ -0,0 +1,182 @@+/* Script for --shared -z combreloc: shared library, combine & sort relocs */+OUTPUT_FORMAT("elf32-i386", "elf32-i386",+	      "elf32-i386")+OUTPUT_ARCH(i386)+ENTRY(_start)+SEARCH_DIR("/usr/i386-redhat-linux/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");+/* Do we need any of these for elf?+   __DYNAMIC = 0;    */+SECTIONS+{+  /* Read-only sections, merged into text segment: */+  . = 0x77fd0000 + SIZEOF_HEADERS;+  .hash           : { *(.hash) }+  .dynsym         : { *(.dynsym) }+  .dynstr         : { *(.dynstr) }+  .gnu.version    : { *(.gnu.version) }+  .gnu.version_d  : { *(.gnu.version_d) }+  .gnu.version_r  : { *(.gnu.version_r) }+  .rel.dyn        :+    {+      *(.rel.init)+      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)+      *(.rel.fini)+      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)+      *(.rel.data.rel.ro*)+      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)+      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)+      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)+      *(.rel.ctors)+      *(.rel.dtors)+      *(.rel.got)+      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)+    }+  .rela.dyn       :+    {+      *(.rela.init)+      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)+      *(.rela.fini)+      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)+      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)+      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)+      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)+      *(.rela.ctors)+      *(.rela.dtors)+      *(.rela.got)+      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)+    }+  .rel.plt        : { *(.rel.plt) }+  .rela.plt       : { *(.rela.plt) }+  .init           :+  {+    KEEP (*(.init))+  } =0x90909090+  .plt            : { *(.plt) }+  .text           :+  {+    *(.text .stub .text.* .gnu.linkonce.t.*)+    KEEP (*(.text.*personality*))+    /* .gnu.warning sections are handled specially by elf32.em.  */+    *(.gnu.warning)+  } =0x90909090+  .fini           :+  {+    KEEP (*(.fini))+  } =0x90909090+  PROVIDE (__etext = .);+  PROVIDE (_etext = .);+  PROVIDE (etext = .);+  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }+  .rodata1        : { *(.rodata1) }+  .eh_frame_hdr : { *(.eh_frame_hdr) }+  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }+  .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }+  /* Adjust the address for the data segment.  We want to adjust up to+     the same address within the page on the next page up.  */+  . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000);+  /* Exception handling  */+  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }+  .gcc_except_table   : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }+  /* Thread Local Storage sections  */+  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }+  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }+  /* Ensure the __preinit_array_start label is properly aligned.  We+     could instead move the label definition inside the section, but+     the linker would then create the section even if it turns out to+     be empty, which isn't pretty.  */+  . = ALIGN(32 / 8);+  .preinit_array     : { KEEP (*(.preinit_array)) }+  .init_array     : { KEEP (*(.init_array)) }+  .fini_array     : { KEEP (*(.fini_array)) }+  .ctors          :+  {+    /* gcc uses crtbegin.o to find the start of+       the constructors, so we make sure it is+       first.  Because this is a wildcard, it+       doesn't matter if the user does not+       actually link against crtbegin.o; the+       linker won't look for a file to match a+       wildcard.  The wildcard also means that it+       doesn't matter which directory crtbegin.o+       is in.  */+    KEEP (*crtbegin*.o(.ctors))+    /* We don't want to include the .ctor section from+       from the crtend.o file until after the sorted ctors.+       The .ctor section from the crtend file contains the+       end of ctors marker and it must be last */+    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))+    KEEP (*(SORT(.ctors.*)))+    KEEP (*(.ctors))+  }+  .dtors          :+  {+    KEEP (*crtbegin*.o(.dtors))+    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))+    KEEP (*(SORT(.dtors.*)))+    KEEP (*(.dtors))+  }+  .jcr            : { KEEP (*(.jcr)) }+  .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }+  .dynamic        : { *(.dynamic) }+  .got            : { *(.got) }+  . = DATA_SEGMENT_RELRO_END (12, .);+  .got.plt        : { *(.got.plt) }+  .data           :+  {+    *(.data .data.* .gnu.linkonce.d.*)+    KEEP (*(.gnu.linkonce.d.*personality*))+    SORT(CONSTRUCTORS)+  }+  .data1          : { *(.data1) }+  _edata = .;+  PROVIDE (edata = .);+  __bss_start = .;+  .bss            :+  {+   *(.dynbss)+   *(.bss .bss.* .gnu.linkonce.b.*)+   *(COMMON)+   /* Align here to ensure that the .bss section occupies space up to+      _end.  Align after .bss to ensure correct alignment even if the+      .bss section disappears because there are no input sections.  */+   . = ALIGN(32 / 8);+  }+  . = ALIGN(32 / 8);+  _end = .;+  PROVIDE (end = .);+  . = DATA_SEGMENT_END (.);+  /* Stabs debugging sections.  */+  .stab          0 : { *(.stab) }+  .stabstr       0 : { *(.stabstr) }+  .stab.excl     0 : { *(.stab.excl) }+  .stab.exclstr  0 : { *(.stab.exclstr) }+  .stab.index    0 : { *(.stab.index) }+  .stab.indexstr 0 : { *(.stab.indexstr) }+  .comment       0 : { *(.comment) }+  /* DWARF debug sections.+     Symbols in the DWARF debugging sections are relative to the beginning+     of the section so we begin them at 0.  */+  /* DWARF 1 */+  .debug          0 : { *(.debug) }+  .line           0 : { *(.line) }+  /* GNU DWARF 1 extensions */+  .debug_srcinfo  0 : { *(.debug_srcinfo) }+  .debug_sfnames  0 : { *(.debug_sfnames) }+  /* DWARF 1.1 and DWARF 2 */+  .debug_aranges  0 : { *(.debug_aranges) }+  .debug_pubnames 0 : { *(.debug_pubnames) }+  /* DWARF 2 */+  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }+  .debug_abbrev   0 : { *(.debug_abbrev) }+  .debug_line     0 : { *(.debug_line) }+  .debug_frame    0 : { *(.debug_frame) }+  .debug_str      0 : { *(.debug_str) }+  .debug_loc      0 : { *(.debug_loc) }+  .debug_macinfo  0 : { *(.debug_macinfo) }+  /* SGI/MIPS DWARF 2 extensions */+  .debug_weaknames 0 : { *(.debug_weaknames) }+  .debug_funcnames 0 : { *(.debug_funcnames) }+  .debug_typenames 0 : { *(.debug_typenames) }+  .debug_varnames  0 : { *(.debug_varnames) }+  /DISCARD/ : { *(.note.GNU-stack) }+}diff -Nru wine-0.9.11.ori/dlls/ntdll/loader.c wine-0.9.11/dlls/ntdll/loader.c--- wine-0.9.11.ori/dlls/ntdll/loader.c	2006-03-31 20:38:27.000000000 +0800+++ wine-0.9.11/dlls/ntdll/loader.c	2007-03-23 09:53:02.000000000 +0800@@ -53,6 +53,13 @@ static int process_detaching = 0;  /* set on process detach to avoid deadlocks with thread detach */ static int free_lib_count;   /* recursion depth of LdrUnloadDll calls */ +#ifdef UNIFIED_KERNEL+static int is_ntdll = 0;+unsigned long BaseProcessStartEntry;++BOOL (* process_init)(void);+void (* PTHREAD_Init)(void);+#endif static const char * const reason_names[] = {     "PROCESS_DETACH",@@ -624,7 +631,11 @@  * Allocate a WINE_MODREF structure and add it to the process list  * The loader_section must be locked while calling this function.  */+#ifndef UNIFIED_KERNEL static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )+#else+WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )+#endif {     WINE_MODREF *wm;     const WCHAR *p;@@ -1286,9 +1297,19 @@         builtin_load_info->status = STATUS_INVALID_IMAGE_FORMAT;         return;     }+#ifndef UNIFIED_KERNEL     addr = module;     NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &nt->OptionalHeader.SizeOfImage,                              MEM_SYSTEM | MEM_IMAGE, PAGE_EXECUTE_WRITECOPY );+#else+    if(is_ntdll)+    {+	    addr = module;+	    NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &nt->OptionalHeader.SizeOfImage,+			    MEM_SYSTEM | MEM_IMAGE, PAGE_EXECUTE_WRITECOPY );+    }+    is_ntdll = 1;+#endif     /* create the MODREF */      if (!(fullname = get_builtin_fullname( builtin_load_info->filename, filename )))@@ -2081,7 +2102,69 @@     return ret; } +#ifdef UNIFIED_KERNEL+/* + * get loaded dll's handle+ */+void *get_dll_handle(char *dll_name)+{+	WCHAR module_name[32];+	PLIST_ENTRY mark, entry;+	PLDR_MODULE mod;+	int len = strlen(dll_name);++	if (len * sizeof(WCHAR) < sizeof(module_name)){+		ascii_to_unicode(module_name, dll_name, len );+		module_name[len] = 0;+		+		if (cached_modref && !strcmpiW(module_name, cached_modref->ldr.FullDllName.Buffer))+			return cached_modref->ldr.SectionHandle;++		mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;+		for (entry = mark->Flink; entry != mark; entry = entry->Flink)+		{+			mod = CONTAINING_RECORD(entry, LDR_MODULE, InMemoryOrderModuleList);+			if (!strcmpiW(module_name, mod->FullDllName.Buffer)){+				cached_modref = CONTAINING_RECORD(mod, WINE_MODREF, ldr);+				return mod->SectionHandle;+			}+		}+		return NULL;+	} else {+		WCHAR *ptr = RtlAllocateHeap(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));+		if (!ptr) return NULL;+		ascii_to_unicode(ptr, dll_name, len);+		ptr[len] = 0;+		+		if (cached_modref && !strcmpiW(ptr, cached_modref->ldr.FullDllName.Buffer))+			return cached_modref->ldr.SectionHandle;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -