想寫一個枚舉硬盤分區的dll

我想寫一個枚舉硬盤分區的dll,代碼如下enumpartition.h
#ifndef _ENUMPARTITION_H_
#define _ENUMPARTITION_H_
#define DLLIMPORT __declspec (dllexport)
typedef struct _EtParition
{
CHAR *path;
} EtPartition;
EtPartition et_pis[20];
ULONG et_np=0;
DLLIMPORT ULONG et_init();
DLLIMPORT CHAR* et_path(ULONG i);
DLLIMPORT UCHAR et_type(ULONG i);
DLLIMPORT LONGLONG et_size(ULONG i);
#endif

enumpartition.c
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <windows.h>
#include <initguid.h> // Guid definition
#include <devguid.h> // Device guids
#include <setupapi.h> // for SetupDiXxx functions.
#include <cfgmgr32.h> // for SetupDiXxx functions.
#include <devioctl.h>
#include <ntdddisk.h>
#include <ntddscsi.h>
#include <enumpartition.h>

BOOL APIENTRY DllMain(HINSTANCE hInstance,
DWORD reason,
{
return TRUE;
}
BOOL GetDeviceProperty(HDEVINFO IntDevInfo, DWORD Index )
{
SP_DEVICE_INTERFACE_DATA interfaceData;
}
DLLIMPORT ULONG et_init()
{
HDEVINFO hDevInfo, hIntDevInfo;
}
DLLIMPORT CHAR* et_path(ULONG i)
{
if(i>=et_np)return NULL;
}
DLLIMPORT UCHAR et_type(ULONG i)
{
if(i>=et_np)return NULL;
}
DLLIMPORT LONGLONG et_size(ULONG i)
{
if(i>=et_np)return NULL;
}

sources
TARGETNAME=enumpartition
TARGETTYPE=DYNLINK
TARGETPATH=obj
TARGETLIBS=$(DDK_LIB_PATH)/setupapi.lib
INCLUDES=$(BASEDIR)/inc;
SOURCES=enumpartition.c



我在ddk的build環境下用build編譯,卻出現如下錯誤
BUILD: Adding /Y to COPYCMD so xcopy ops won't hang.
BUILD: Object root set to: ==> objchk_wxp_x86
BUILD: Compile and Link for i386
BUILD: Loading C:/WINDDK/3790/build.dat...
BUILD: Computing Include file dependencies:
BUILD: Examining d:/enumpartition directory for files to compile.
    d:/enumpartition - 1 source files (166 lines)
BUILD: Compiling d:/enumpartition directory
Compiling - enumpartition.c for i386
NMAKE :  U1073: don't know how to make 'enumpartition.def'
BUILD: nmake.exe failed - rc = 2
BUILD: Compile errors: not linking d:/enumpartition directory
BUILD: Done

    2 files compiled - 2 Warnings - 1 Error -   166 LPS





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章