You are on page 1of 3

##

## Copyright (C) Huawei Technologies Co., Ltd. 2004-2005. All rights reserved.
##
How to use: DevSetup.dll
1, DWORD DevSetup(BYTE byType, bool bDebug);
Descprition:
Install function, Uninstall funtion, Query funciton, Help funciton
Open/Colse debug informaiton
patameter:
byType:
0:
1:
2:
em;
3:

function type
Install the driver;
Uninstall the driver;
Duery whether we have installed driver in the Windows operating syst
Help information;

bDebug: Open/Colse debug informaiton


true: Open the debug information
false: Close the debug information
return value:
0: success
other value: failure, please refer to the "Failure code"
2, DWORD Install(void);
Descprition:
Install the driver;
return value:
0: success
other value: failure, please refer to the "Failure code"
3, DWORD Uninstall(void);
Descprition:
Uninstall the driver;
return value:
0: success
other value: failure, please refer to the "Failure code"
4, DWORD Detect(void);
Descprition:
Duery whether we have installed driver in the Windows operating system;
return value:
0: success
other value: failure, please refer to the "Failure code"
5, DWORD Help(void);
Descprition:
Help information;
return value:
0: success
other value: failure, please refer to the "Failure code"

How to use: DevSetup.exe


1, Install
EXEC [PATH/]DevSetup /install
2, Uninstall
EXEC [PATH/]DevSetup /uninstall
3, Detect
EXEC [PATH/]DevSetup /detect
4, Usage
EXEC [PATH/]DevSetup /help OR EXEC [PATH/]DevSetup ?
return value:
0: success
other value: failure, please refer to the "Failure code"

Failure code
// have already had a Process in the operating system which handle the driver;
#define DEV_SETUP_ERROR_ALREADY_EXISTS
DWORD(20001)
// Command parameter error
#define DEV_SETUP_ERROR_INVALID_CMD
// Do not support this Windows version
#define DEV_SETUP_ERROR_INVALID_SYS_VER
// Can not find driver install file
#define DEV_SETUP_ERROR_EMPTY_DIR
// Install failure
#define DEV_SETUP_ERROR_INSTALL_FAIL
// Delete the driver failure;
#define DEV_SETUP_ERROR_REMOVE_FAIL

DWORD(20002)
DWORD(20003)
DWORD(20004)
DWORD(20005)
DWORD(20006)

// Do not find the driver;


#define DEV_SETUP_DRIVER_NOT_EXISTS

DWORD(10000)

// driver already exist;


#define DEV_SETUP_DRIVER_ALREADY_EXISTS

DWORD(10001)

Sample Code(DevSetup.exe):
#include <Windows.h>
#include <Winbase.h>
#include <stdio.h>
void main(void)
{
STARTUPINFO si;

PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL,
"DevSetup /install",
/help]
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi )
ure.
)
{
return;
}

// No module name (use command line).


// Command line. [/uninstall | /detect |
//
//
//
//
//
//
//
//

Process handle not inheritable.


Thread handle not inheritable.
Set handle inheritance to FALSE.
No creation flags.
Use parent's environment block.
Use parent's starting directory.
Pointer to STARTUPINFO structure.
Pointer to PROCESS_INFORMATION struct

// Wait until child process exits.


WaitForSingleObject( pi.hProcess, INFINITE );
DWORD

dwReturn;

GetExitCodeProcess(pi.hProcess, &dwReturn);
printf("%d", dwReturn);
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return;
}

You might also like