سؤال

سامحني لكوني مبتدئ كاملة مع ويندوز DDK.

يجب إنشاء ملف بسيط اسمه test.cpp:

#include <windows.h>

#define BAD_ADDRESS 0xBAADF00D

int __cdecl main(int argc, char* args[])
{
    char* p =(char*)BAD_ADDRESS;
    *p='A';
    return 0;
}

في نفس الدليل أنا خلقت sources ملف مثل هذا:

TARGETNAME=test
TARGETTYPE=PROGRAM
TARGETPATH=obj

TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib 

SOURCES= test.cpp

و makefile مثل هذا:

#
# DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source
# file to this component.  This file merely indirects to the real make file
# that is shared by all the components of Windows
#
!INCLUDE $(NTMAKEENV)\makefile.def

بعد إطلاق ويندوز XP مجانا بناء بيئة لقد استعرض للوصول إلى الدليل مع الملفات الثلاثة (test.cpp, makefile و المصادر) ثم قم بتشغيل الأمر التالي:

F:\temp\debug\dir1>build -cZg

التي النواتج:

BUILD: Adding /Y to COPYCMD so xcopy ops won't hang.
BUILD: Using 2 child processes
BUILD: Object root set to: ==> objfre_wxp_x86
BUILD: Compile and Link for i386
BUILD: Examining f:\temp\debug\dir1 directory for files to compile.
BUILD: Compiling (NoSync) f:\temp\debug\dir1 directory
1>Compiling - test.cpp for i386
BUILD: Compiling  f:\temp\debug\dir1 directory
BUILD: Linking f:\temp\debug\dir1 directory
1>Linking Executable - objfre_wxp_x86\i386\test.exe for i386
BUILD: Done

    2 files compiled
    1 executable built

المشكلة هي أنه عند تشغيل إنشاء قابل للتنفيذ test.exe يقول:

F:\temp\debug\dir1\objfre_wxp_x86\i386>test
The F:\temp\debug\dir1\objfre_wxp_x86\i386\test.exe application cannot be run in Win32 mode.

ما أنا في عداد المفقودين هنا ؟

هل كانت مفيدة؟

المحلول

روب ووكر ما يفسر لماذا ولكن نواة الخردل يشرح كيف.

نصائح أخرى

كنت قد جمعت 'التطبيق الأصلي' بدلا من win32 واحد.على TARGET_TYPE تعريف عناصر التحكم هذه.

انظر 'داخل التطبيقات الأصلية'لمناقشة باستخدام DDK لتوليد التطبيق الأصلي.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top