第一次提交qt版工具

This commit is contained in:
mo1027728827@qq.com 2021-10-28 14:02:07 +08:00
parent ce535ed50a
commit 35a9c7b602
556 changed files with 463687 additions and 0 deletions

View File

@ -0,0 +1,22 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
QMAKE_CXX.QMAKE_MSC_VER = 1929
QMAKE_CXX.QMAKE_MSC_FULL_VER = 192930038
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_MSC_VER \
QMAKE_MSC_FULL_VER
QMAKE_CXX.INCDIRS = \
"D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30037\\ATLMFC\\include" \
"D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30037\\include" \
"C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" \
"D:\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt" \
"D:\\Windows Kits\\10\\include\\10.0.19041.0\\shared" \
"D:\\Windows Kits\\10\\include\\10.0.19041.0\\um" \
"D:\\Windows Kits\\10\\include\\10.0.19041.0\\winrt" \
"D:\\Windows Kits\\10\\include\\10.0.19041.0\\cppwinrt"
QMAKE_CXX.LIBDIRS = \
"D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30037\\ATLMFC\\lib\\x86" \
"D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30037\\lib\\x86" \
"C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x86" \
"D:\\Windows Kits\\10\\lib\\10.0.19041.0\\ucrt\\x86" \
"D:\\Windows Kits\\10\\lib\\10.0.19041.0\\um\\x86"

View File

@ -0,0 +1,104 @@
#pragma once
#include <mutex>
#include <condition_variable>
#include <deque>
#include <iostream>
#include <exception>
template <typename T>
class BlockingQueue
{
private:
BlockingQueue(const BlockingQueue &rhs);
BlockingQueue &operator=(const BlockingQueue &rhs);
mutable std::mutex _mutex;
std::condition_variable _condvar;
std::deque<T> _queue;
bool isShutDown = false;
T tRet;
public:
BlockingQueue()
: _mutex(), _condvar(), _queue()
{
}
~BlockingQueue()
{
ShutDown();
std::cout << "blocking queue release" << std::endl;
}
void ShutDown()
{
isShutDown = true;
_condvar.notify_all();
_queue.clear();
}
bool IsShutDown()
{
return isShutDown;
}
void Put(const T task)
{
std::lock_guard<std::mutex> lock(_mutex);
if (!isShutDown)
{
{
_queue.push_back(task);
}
_condvar.notify_all();
}
}
T Take()
{
std::unique_lock<std::mutex> lock(_mutex);
if (_queue.size() <= 0)
_condvar.wait(lock);
if (isShutDown || _queue.empty())
{
return tRet;
}
T front(_queue.front());
_queue.pop_front();
return front;
}
T Front()
{
std::unique_lock<std::mutex> lock(_mutex);
if (_queue.size() <= 0)
_condvar.wait(lock);
if (isShutDown || _queue.empty())
{
return tRet;
}
T front(_queue.front());
return front;
}
size_t Size() const
{
std::lock_guard<std::mutex> lock(_mutex);
return _queue.size();
}
void Clear()
{
std::unique_lock<std::mutex> lock(_mutex);
if (_queue.size() <= 0)
return;
if (_queue.size()>0)
{
_queue.clear();
}
}
};

18
qt-correction-tool/IUsb.h Normal file
View File

@ -0,0 +1,18 @@
#pragma once
typedef void(*usbhotplug_callback)(bool isleft, void* userdata);
class IUsb
{
public:
virtual ~IUsb() {}
virtual bool open() = 0;
virtual void set_usbhotplug_callback(usbhotplug_callback callback = nullptr, void* userdata = nullptr) = 0;
virtual bool close() = 0;
virtual bool is_open() = 0;
virtual bool is_connected() = 0;
virtual void set_timeout(int timeout) = 0;
virtual int read_bulk(void* data, int len) = 0;
virtual int write_bulk(void* data, int len) = 0;
virtual int read_int(void* data, int len) = 0;
virtual int control_msg(int rtype, int req, int value, int index, int len, void* data) = 0;
};

View File

@ -0,0 +1,184 @@
#include "StdAfx.h"
#include "ImageMatQueue.h"
#include "filetools.h"
#include "imageprocess.h"
#include <QDebug>
static int imgindex = 0;
ImageMatQueue::ImageMatQueue(void)
{
pixType = -1;
DevModel = -1;
bScanning = false;
imageremain = 0;
pic_suffix = "bmp";
}
void ImageMatQueue::run()
{
if (m_threadProc.joinable())
{
bRun = false;
m_threadProc.join();
}
bRun = true;
imgindex = 0;
m_threadProc = std::thread(&ImageMatQueue::proc, this);
}
void ImageMatQueue::setmultioutputR(bool canoutput/*=false*/)
{
can_multi_outputR = canoutput;
}
void ImageMatQueue::SetDevModel(int dev/*=-1*/)
{
DevModel = dev;
}
ImageMatQueue::~ImageMatQueue(void)
{
if (m_images.Size() > 0)
{
m_images.Clear();
m_images.ShutDown();
}
if (m_pImages.Size() > 0)
{
m_pImages.Clear();
m_pImages.ShutDown();
}
if (m_threadProc.joinable())
{
bRun = false;
m_threadProc.join();
}
}
void ImageMatQueue::pushMat(JpegBuffer& data)
{
imageremain++;
m_pImages.Put(data);
int k = 0;
}
QString ImageMatQueue::popMat(int num)
{
return m_images.Take();
}
bool ImageMatQueue::valid()
{
return m_images.Size();
}
void ImageMatQueue::clear()
{
while (m_images.Size() > 0)
{
m_images.Take();
}
while (m_pImages.Size() > 0)
{
m_pImages.Clear();
}
}
int ImageMatQueue::getMatSum()
{
int iSum = 0;
iSum = m_images.Size();
return iSum;
}
bool ImageMatQueue::isScanning()
{
return (imageremain != 0) || (m_pImages.Size() != 0);
}
bool ImageMatQueue::empty()
{
return m_images.Size() == 0 && imageremain == 0 && !bScanning;
}
void ImageMatQueue::proc()
{
while (bRun)
{
this_thread::sleep_for(std::chrono::milliseconds(5));
{
if (m_pImages.Size() > 0)//m_images.empty() &&
{
if (pixType != -1)
{
QString csName;
SYSTEMTIME st = { 0 };
GetLocalTime(&st); //获取当前时间 可精确到ms
csName.sprintf("%02d%02d%02d-%d.", st.wHour, st.wMinute, st.wSecond, ++imgindex);
csName += pic_suffix;
cv::Mat matPicImage;
cv::Mat matFront, matBack;
vector<cv::Mat> mats;
switch (DevModel)
{
case 0://G100
case 1://G200//正反面图像分开的
{
if (m_pImages.Size() >= 2)
{
matFront = m_pImages.Take().getMat(pixType);
matBack = m_pImages.Take().getMat(pixType);
mats.push_back(matFront);
mats.push_back(matBack);
for (int i = 0; i < mats.size(); ++i)
{
QString qsImage = csPath;
QString qsName = "/G200_" + QString::number(i) + "_" + csName;
qsImage += qsName;
#ifdef WIN32
qsImage.replace("/", "\\");
#endif // WIN32
cv::imwrite(qsImage.toStdString(), mats[i]);
m_images.Put(qsImage);
size_t size = m_images.Size();
///qDebug(" m_images.Size() %d", size);
}
}
}
break;
case 2://G300
case 3://G400
case 4://G500 正反面图像在一副图上,需要均分图像
{
QString csImage;
csImage = csPath + "/G300" + csName;
#ifdef WIN32
csImage.replace("/", "\\");
#endif // WIN32
cv::Mat mat = m_pImages.Take().getMat(pixType);//1 color 6 gray
cv::imwrite(csImage.toStdString(), mat);
m_images.Put(csImage);
size_t size = m_images.Size();
qDebug(" m_images.Size() %d", size);
}
break;
default:
break;
}
if (DevModel == 0 || DevModel == 1)
{
for (int i = 0; i < mats.size(); i++)
{
imageremain--;
}
}
else
imageremain--;
}
}
}
}
}

View File

@ -0,0 +1,62 @@
#pragma once
#include <thread>
#include <mutex>
#include <opencv2/opencv.hpp>
#include "JpegBuffer.h"
#include <queue>
#include "BlockingQueue.h"
#include <QString>
class ImageMatQueue
{
public:
ImageMatQueue(void);
virtual ~ImageMatQueue(void);
void pushMat(JpegBuffer& data);
QString popMat(int num);
bool empty();
bool valid();
void clear();
void run();
int getMatSum();
bool isScanning();
void SetScanFlag(bool scannning) { bScanning = bScanning; }
void SetFilePath(QString csFilePath)
{
csPath = csFilePath;
}
void SetPicformat(QString picformat)
{
pic_suffix = picformat;
}
QString GetFilePath()
{
return csPath;
}
public:
int pixType;
void setmultioutputR(bool canoutput = false);
void SetDevModel(int dev = -1);
QString csPath;
QString pic_suffix;
private:
void proc();
BlockingQueue<QString> m_images; //!< ÒÑ´¦ÀíͼÏñ¶ÓÁÐ
BlockingQueue<JpegBuffer> m_pImages;
std::thread m_threadProc;
volatile bool bRun;
bool can_multi_outputR;
int DevModel;
volatile bool bScanning;
volatile int imageremain;
};

View File

@ -0,0 +1,87 @@
#include "StdAfx.h"
#include "JpegBuffer.h"
#include "jpeglib.h"
//#include "twain.h"
#include "filetools.h"
using namespace std;
JpegBuffer::JpegBuffer()
{
}
JpegBuffer::JpegBuffer(cv::Mat buffer, int color_type,int side,int mFilter)
{
this->m_buffer = buffer;
this->m_color_type=color_type;
this->m_side=side;
this->m_mFilter=mFilter;
}
JpegBuffer::~JpegBuffer(void)
{
}
unsigned char* JpegBuffer::getBuffer()
{
return m_buffer.data;
}
cv::Mat JpegBuffer::buffer()
{
return m_buffer;
}
int JpegBuffer::getSize()
{
return m_buffer.cols;
}
cv::Mat JpegBuffer::getMat( int pixType)
{
JpegLib jl;
//cv::Mat image = jl.decode(m_buffer, 6);//oixtype
StopWatch sw;
sw.start();
//XdPrint("buffer size is :%d ==========================\n",getSize());
cv::Mat image = jl.decode(m_buffer, pixType);//oixtype
sw.stop();
//XdPrint("Decode Image time epleased :%lf ==========================\n",sw.time_run());
//XdPrint("==image col is :%d, image row is :%d, image size is :%d===\n",image.cols, image.rows, image.size);
//FileTools::write_log("D:/1.txt",)
//cv::InputArray arr(m_buffer);
//
//cv::Mat image1=imdecode(arr,m_color_type==TWPT_RGB?CV_LOAD_IMAGE_COLOR:CV_LOAD_IMAGE_GRAYSCALE);
//cv::imwrite("0.bmp",image1);
//char str[256];
//sprintf(str, "%lf", sw.time_run());
//string res=str;
//FileTools::write_log("D:/1.txt",res);
//0 ÕýÃæ 1·´Ãæ
//if (!backRotate&&(m_side==0||m_side==1))
//{
// cv::Rect rect(0, m_side == 0 ? 0 : gap, image.cols,(image.rows-gap));
// image = image(rect);
//}
return image.clone();
}
int JpegBuffer::getMFilter()
{
return m_mFilter;
}
int JpegBuffer::getSide()
{
return m_side;
}

View File

@ -0,0 +1,23 @@
#pragma once
#include <opencv2/opencv.hpp>
#include "jpeglib.h"
class JpegBuffer
{
public:
JpegBuffer();
JpegBuffer(cv::Mat buffer,int color_type=2,int side=0,int mFilter=0);
virtual ~JpegBuffer(void);
unsigned char* getBuffer();
cv::Mat buffer();
int getSize();
cv::Mat getMat( int pixType);
int getMFilter();
int getSide();
private:
cv::Mat m_buffer;
int m_color_type;
int m_side;
int m_mFilter;
};

View File

@ -0,0 +1,107 @@
#include "stdafx.h"
#include "JsonConfig.h"
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#ifdef WIN32
#include <corecrt_io.h>
#else
#include <unistd.h>
#endif
#define JSON_FILE "config.json"
#define SCAN_INFO_TITLE "ScanInfo"
#define SCAN_TOTAL "TotalScanned"
#define SCAN_CUONUM "CuoNum"
#define SCAN_JAMINNUM "JamInNum"
#define SCAN_JAMOUTNUM "JamOutNum"
#define SCAN_DOUNUM "DoubleNum"
#define SCAN_ERRORNUM "ErrorNum"
#define SCAN_SERIALNUM "SerialNum"
#define SCAN_FWVERSION "FWVersion"
JsonConfig::JsonConfig()
{
//if (access(SCANNER_SCAN_INFO_PATH, F_OK) == -1) //不存在
//{
// ScannerScanInfo defaultinfo = CreateDefaultScanInfo();
// SaveScanInfo(defaultinfo);
//}
}
JsonConfig::JsonConfig(ConfigType type) : m_cfgType(type)
{
}
JsonConfig::~JsonConfig()
{
}
bool JsonConfig::ReadParam(CaptureParams& param)
{
if(_access(JSON_FILE,0)!=0)
{
CaptureParams t_param = { 0 };
CreateDefault(t_param);
WriteParam(t_param);
param = t_param;
return false;
}
std::ifstream i(JSON_FILE);
json j;
i >> j;
auto &jobject = j["Config"];
jobject["CorrectColorExposure"].get_to(param.correctColorExposure);
jobject["CorrectColorGain"].get_to(param.correctColorGain);
jobject["CorrectColorOffset"].get_to(param.correctColorOffset);
jobject["ColorExposure"].get_to(param.colorExposure);
jobject["ColorGain"].get_to(param.colorGain);
jobject["ColorOffset"].get_to(param.colorOffset);
jobject["CorrectGrayExposure"].get_to(param.correctGrayExposure);
jobject["CorrectGrayGain"].get_to(param.correctGrayGain);
jobject["CorrectGrayOffset"].get_to(param.correctGrayOffset);
jobject["GrayExposure"].get_to(param.grayExposure);
jobject["GrayGain"].get_to(param.grayGain);
jobject["GrayOffset"].get_to(param.grayOffset);
return true;
}
void JsonConfig::WriteParam(CaptureParams& t_param)
{
json m_json;
auto &jobject = m_json["Config"];
jobject["CorrectColorExposure"] = t_param.correctColorExposure;
jobject["CorrectColorGain"] = t_param.correctColorGain;
jobject["CorrectColorOffset"] = t_param.correctColorOffset;
jobject["ColorExposure"] = t_param.colorExposure;
jobject["ColorGain"] = t_param.colorGain;
jobject["ColorOffset"] = t_param.colorOffset;
jobject["CorrectGrayExposure"] = t_param.correctGrayExposure;
jobject["CorrectGrayGain"] = t_param.correctGrayGain;
jobject["CorrectGrayOffset"] = t_param.correctGrayOffset;
jobject["GrayExposure"] = t_param.grayExposure;
jobject["GrayGain"] = t_param.grayGain;
jobject["GrayOffset"] = t_param.grayOffset;
std::ofstream o(JSON_FILE);
o << std::setw(4) << m_json << std::endl;
}
void JsonConfig::CreateDefault(CaptureParams& param)
{
for (size_t i = 0; i <6; i++)
{
param.colorExposure[i] = 259;
param.correctColorExposure[i] = 238;
param.correctGrayExposure[i] = 259;
param.grayExposure[i] = 238;
}
for (size_t i = 0; i <12; i++)
{
param.correctGrayGain[i] = param.grayGain[i] = 47;
param.colorGain[i] = param.correctColorGain[i] = 30;
param.correctColorOffset[i] = param.correctGrayOffset[i] = 119;
param.colorOffset[i] = param.grayOffset[i] = 119;
}
}

View File

@ -0,0 +1,52 @@
#pragma once
#include "json.hpp"
#include <string>
#include <map>
#include "PublicFunc.h"
#define SCANNER_SCAN_INFO_PATH "/usr/local/huago/jsonconfig.json"
using namespace std;
using json = nlohmann::json;
class JsonConfig
{
public:
enum class ConfigType
{
Color_Flat,
Color_Correct,
Gray_Flat,
Gray_Correct
};
private:
map<ConfigType,string> cfgPaths={
{ConfigType::Color_Flat,"/usr/local/etc/huago/Color_Flat.json"},
{ConfigType::Color_Correct,"/usr/local/etc/huago/Color_Correct.json"},
{ConfigType::Gray_Flat,"/usr/local/etc/huago/Gray_Flat.json"},
{ConfigType::Gray_Correct,"/usr/local/etc/huago/Gray_Correct.json"}
};
map<ConfigType,string> cfgPrefix={
{ConfigType::Color_Flat,"Color_Flat"},
{ConfigType::Color_Correct,"Color_Correct"},
{ConfigType::Gray_Flat,"Gray_Flat"},
{ConfigType::Gray_Correct,"Gray_Correct"}
};
ConfigType m_cfgType;
public:
JsonConfig();
JsonConfig(ConfigType type);
~JsonConfig();
/*
*false
*/
bool ReadParam(CaptureParams& param);
void WriteParam(CaptureParams& t_param);
// ScannerScanInfo GetScanInfo();
//
// void SaveScanInfo(const ScannerScanInfo& info);
private:
void CreateDefault(CaptureParams& param);
// ScannerScanInfo CreateDefaultScanInfo();
};

View File

@ -0,0 +1,53 @@
#pragma once
#include <windows.h>
//对临界区同样进行封装
class CMyCriticalSection
{
public:
CMyCriticalSection()
{
InitializeCriticalSection(&m_cSection);
}
void Lock()
{
EnterCriticalSection(&m_cSection);
}
void UnLock()
{
LeaveCriticalSection(&m_cSection);
}
//利用析构函数删除临界区对象
virtual ~CMyCriticalSection()
{
DeleteCriticalSection(&m_cSection);
}
private:
CRITICAL_SECTION m_cSection;
};
class CCriticalSectionAutoLock
{
public:
//利用构造函数上锁,即进去临界区
CCriticalSectionAutoLock(CMyCriticalSection *mySection):pCMySection(mySection)
{
pCMySection->Lock();
}
//利用析构函数解锁,即离开临界区
virtual ~CCriticalSectionAutoLock()
{
pCMySection->UnLock();
}
private:
CMyCriticalSection *pCMySection;
};

View File

@ -0,0 +1,10 @@
#include "stdafx.h"
#include "PublicFunc.h"
#ifdef WIN32
#include <io.h>
#endif
#include <map>
using namespace std;

View File

@ -0,0 +1,70 @@
#ifndef PUBLICFUNC_H_
#define PUBLICFUNC_H_
#include "stdafx.h"
#include <string>
using namespace std;
//yi zhi
#ifdef WIN32
#else
typedef unsigned int UINT32;
typedef unsigned int UINT;
typedef unsigned char byte;
typedef int BOOL;
typedef unsigned short UINT16;
typedef int INT;
typedef unsigned long DWORD;
#endif
struct tagCONFIGINFO
{
std::string Caption;
std::string SavePath;
};
struct SPSET
{
unsigned int FSP;
unsigned int BSP;
};
typedef struct tagCONFIGINFO CONFIGINFO,*PCONFIGINFO;
typedef struct CorrectParam {
unsigned int Exposures[6];
unsigned int Gain[12];
unsigned int Offset[12];
};
typedef struct CaptureParams
{
int correctColorExposure[6];
int correctColorGain[12];
int correctColorOffset[12];
int correctGrayExposure[6];
int correctGrayGain[12];
int correctGrayOffset[12];
int colorExposure[6];
int colorGain[12];
int colorOffset[12];
int grayExposure[6];
int grayGain[12];
int grayOffset[12];
int uvCorrectColorExposure[2];
int uvCorrectGrayExposure[2];
int uvColorExposure[2];
int uvGrayExposure[2];
} CaptureParams;
#endif

View File

@ -0,0 +1,148 @@
{
"Config": {
"ColorExposure": [
259,
259,
259,
259,
259,
259
],
"ColorGain": [
30,
30,
30,
30,
30,
30,
30,
30,
30,
30,
30,
30
],
"ColorOffset": [
119,
119,
119,
119,
119,
119,
119,
119,
119,
119,
119,
119
],
"CorrectColorExposure": [
238,
238,
238,
238,
238,
238
],
"CorrectColorGain": [
30,
30,
30,
30,
30,
30,
30,
30,
30,
30,
30,
30
],
"CorrectColorOffset": [
119,
119,
119,
119,
119,
119,
119,
119,
119,
119,
119,
119
],
"CorrectGrayExposure": [
259,
259,
259,
259,
259,
259
],
"CorrectGrayGain": [
47,
47,
47,
47,
47,
47,
47,
47,
47,
47,
47,
47
],
"CorrectGrayOffset": [
119,
119,
119,
119,
119,
119,
119,
119,
119,
119,
119,
119
],
"GrayExposure": [
238,
238,
238,
238,
238,
238
],
"GrayGain": [
47,
47,
47,
47,
47,
47,
47,
47,
47,
47,
47,
47
],
"GrayOffset": [
119,
119,
119,
119,
119,
119,
119,
119,
119,
119,
119,
119
]
}
}

View File

@ -0,0 +1,70 @@
#pragma once
#include <vector>
#ifdef WIN32
#include <Windows.h>
#include <io.h>
#endif
#include <fstream>
class FileTools
{
public:
static std::vector<std::string> getFiles(std::string path)
{
std::vector<std::string> files;
getFiles(path, files);
return files;
}
static void write_log(std::string filepath, std::string log)
{
std::ofstream ofs(filepath, std::ios::app);
ofs << log << std::endl;
}
private:
static void getFiles(std::string path, std::vector<std::string>& files)
{
//文件句柄
long hFile = 0;
//文件信息
struct _finddata_t fileinfo;
std::string p;
if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo))!=-1)
{
do
{
//如果是目录,迭代之
//如果不是,加入列表
if ((fileinfo.attrib & _A_SUBDIR))
{
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
getFiles(p.assign(path).append("\\").append(fileinfo.name), files);
}
else
{
files.push_back(p.assign(path).append("\\").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}
};
class StopWatch
{
public:
StopWatch() { valEnd = valStart = clock(); }
void start() { valStart = clock(); }
void stop() { valEnd =clock(); }
double time_run() { return (double)(valEnd - valStart)/CLOCKS_PER_SEC; }
private:
clock_t valStart;
clock_t valEnd;
};

View File

@ -0,0 +1,885 @@
#include "stdafx.h"
#include "gscn_drv.h"
#include "stdio.h"
#include "turbojpeg.h"
#include <map>
#include "jpeglib.h"
#ifdef WIN32
#include <Windows.h>
#include "twain.h"
#endif
#include "filetools.h"
#include "scn_usb.h"
//#define BYTE unsigned char
GScn_Drv::GScn_Drv()
:selectDeviceIndex(-1), m_scannerType(-1), m_isScanning(false), flatMode(-1), usbcbDate(NULL)
{
//run();
////XdPrint("Init GScn_Drv() \n");
m_bRun = false;
devState = DEV_STOP;
isDuplex = true;
InitMSGMap();
InitScannerDiviceMap();
usbcbDate = new char ;
}
GScn_Drv::~GScn_Drv()
{
if (m_threadUsb.joinable())
{
m_bRun = false;
devState = DEV_STOP;
m_threadUsb.join();
//XdPrint("m_threadUsb Released True 22222222222222222222222 \n");
}
//XdPrint("~ GScn_Drv() \n");
}
void GScn_Drv::InitMSGMap()
{
if (ntcMsg.size() > 0)
ntcMsg.clear();
ntcMsg[COUNT_MODE] = "计数模式,请先退出计数模式!";
ntcMsg[NO_FEED] = "无纸,请放置纸张!";
ntcMsg[OPEN_COVER] = "扫描仪开盖!";
ntcMsg[FEED_IN_ERROR] = "拾纸错误!";
ntcMsg[PAPER_JAM] = "卡纸!";
ntcMsg[DETECT_DOUBLE_FEED] = "双张!";
ntcMsg[DETECT_STAPLE] = "订书针!";
ntcMsg[PAPER_SKEW] = "纸张歪斜!";
ntcMsg[HARDWARE_ERROR] = "硬件错误!";
ntcMsg[PC_SCAN_BUSY_or_ERROR] = "PC错误";
}
void GScn_Drv::InitScannerDiviceMap()
{
if (devType.size() > 0)
{
devType.clear();
}
devType["G100"] = G100;
devType["G200"] = G200;
devType["G300"] = G300;
devType["G400"] = G400;
devType["G500"] = G500;
}
static int iNum = 0;
void GScn_Drv::open(int vid, int pid, int index, int scannerType)
{
auto devs = UsbScan_List::find_vid_pid(vid, pid);
if (devs.size() != 0)
{
m_usb = *devs.begin();
m_usb->open();//同时存在多个同种扫描设备时默认选取第一个vid pid匹配的设备
selectDeviceIndex = index;
m_scannerType = scannerType;
}
}
static void DoEvents()
{
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
DispatchMessage(&msg);
TranslateMessage(&msg);
}
}
QString GScn_Drv::popMat(int num)
{
auto image = m_pImages.popMat(num);
return image;
}
int GScn_Drv::aquire_image(QString& image, int num)
{
while (true)
{
if (Get_IsImageQueueEmpty())
{
DoEvents();
if (!is_scan())
break;
}
else
{
if (m_pImages.valid())
{
image = popMat(num);
return 0;
}
}
}
return -1;
}
int GScn_Drv::getMatSum()
{
int iSum = 0;
iSum = m_pImages.getMatSum();
return iSum;
}
void GScn_Drv::close()
{
m_usb->close();
}
void GScn_Drv::GetExpose(UINT32& Aside, UINT32& Bside)
{
USBCB asideexp = { GET_UV_EXPOSA,0,0 };
m_usb->write_bulk(&asideexp, sizeof(asideexp));
m_usb->read_bulk(&asideexp, sizeof(asideexp));
Aside = asideexp.u32_Data;
USBCB bsideexp = { GET_UV_EXPOSB,0,0 };
m_usb->write_bulk(&bsideexp, sizeof(asideexp));
m_usb->read_bulk(&bsideexp, sizeof(asideexp));
Bside = bsideexp.u32_Data;
}
void GScn_Drv::SetExpose(UINT32 aside, UINT32 bside)
{
USBCB asideexp = { SET_UV_EXPOSA,aside,0 };
m_usb->write_bulk(&asideexp, sizeof(asideexp));
USBCB bsideexp = { SET_UV_EXPOSB,bside,0 };
m_usb->write_bulk(&bsideexp, sizeof(bsideexp));
}
void GScn_Drv::GetSptime(UINT32 type, UINT32& time)
{
USBCB usb = { 0,0,0 };
switch (type)
{
case 0:
usb.u32_CMD = 0x100;//GET_GRAY_SP
break;
case 1:
usb.u32_CMD = 0x102;//GET_COLOR_SP
break;
case 2:
usb.u32_CMD = 0x104;//GET_UV_SP
break;
default:
break;
}
m_usb->write_bulk(&usb, sizeof(usb));
m_usb->read_bulk(&usb, sizeof(usb));
time = usb.u32_Data;
}
void GScn_Drv::SetSptime(UINT32 type, UINT32 time)
{
USBCB usb = { 0,time,0 };
switch (type)
{
case 0:
usb.u32_CMD = 0x101;//GET_GRAY_SP
break;
case 1:
usb.u32_CMD = 0x103;//GET_COLOR_SP
break;
case 2:
usb.u32_CMD = 0x105;//GET_UV_SP
break;
default:
break;
}
m_usb->write_bulk(&usb, sizeof(usb));
}
void GScn_Drv::GetSleepTime(UINT32& sleeptime)
{
if (m_usb.get() && m_usb->is_connected())
{
USBCB usb = { GET_SLEEP_TIME,0,0 };
m_usb->write_bulk(&usb, sizeof(usb));
m_usb->read_bulk(&usb, sizeof(usb));
sleeptime = usb.u32_Data;
}
}
void GScn_Drv::SetSleepTime(UINT32 sleeptime)
{
if (m_usb.get() && m_usb->is_connected())
{
USBCB usb = { SET_SLEEP_TIME,sleeptime,0 };
m_usb->write_bulk(&usb, sizeof(usb));
}
}
void GScn_Drv::SetSpeedMode(UINT32 speedmode)
{
if (m_usb.get() && m_usb->is_connected())
{
USBCB usb = { SET_SPEED_MODE,speedmode,0 };
m_usb->write_bulk(&usb, sizeof(usb));
}
}
void GScn_Drv::SetG100G200CorrecPara(UINT32 Para, int a)
{
if (!m_usb.get() && !m_usb->is_connected())
return;
USBCB usb = { 0,Para,4 };
switch (a)
{
case 0:
usb.u32_CMD = SEND_COMPONENTS_GR;
break;
case 1:
usb.u32_CMD = SEND_COMPONENTS_GB;
break;
case 2:
usb.u32_CMD = RGB_ADI_PARA;
break;
case 3:
usb.u32_CMD = ADI_PARA;
break;
}
m_usb->write_bulk(&usb, sizeof(usb));
}
void GScn_Drv::GetG100G200CorrecPara(unsigned char *parm, int a)
{
if (!m_usb.get() && !m_usb->is_connected())
{
qDebug("未获取到设备\r\n");
return;
}
USBCB usb = { GET_CIS_PARA,0 ,16 };
m_usb->write_bulk(&usb, sizeof(usb));
m_usb->read_bulk(parm, 16);
}
void GScn_Drv::stopTime(std::function<void()> onStop)
{
m_onStopQtime = onStop;
}
void GScn_Drv::retdevMessges(std::function<void(const char* ptr)>devMessges)
{
callbackDevMessge = devMessges;
}
int GScn_Drv::ModeSelection(list<int>& dpi300GC_dpi200GC)
{
if (dpi300GC_dpi200GC.empty())
{
return -1;
}
iNum = 0;
m_pImages.pixType = pixType;
m_pImages.SetDevModel(m_scannerType);
m_pImages.SetFilePath(csPath);
m_pImages.SetPicformat(qsPic_format_name);
m_pImages.run();
m_pImages.SetScanFlag(true);
this->dpi300GC_dpi200GC = dpi300GC_dpi200GC;
Flat();
return 0;
}
void GScn_Drv::Flat()
{
if (this->dpi300GC_dpi200GC.empty())
{
return;
}
flatMode = this->dpi300GC_dpi200GC.front();
this->dpi300GC_dpi200GC.pop_front();
if (!m_usb->is_connected())
return;
USBCB usbcb = { START_FLAT,0,0 };
usbcb.u32_Data = flatMode;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
}
void GScn_Drv::GetSpeedMode(UINT32& speedmode)
{
if (m_usb.get() && m_usb->is_connected())
{
USBCB usb = { GET_SPEED_MODE ,speedmode,0 };
m_usb->write_bulk(&usb, sizeof(usb));
m_usb->read_bulk(&usb, sizeof(usb));
speedmode = usb.u32_Data;
}
}
void GScn_Drv::reset()
{
while (!m_pImages.empty())
{
m_pImages.clear();
}
}
void GScn_Drv::pushMat(JpegBuffer& data)
{
std::lock_guard<std::mutex> lck(m_imgLocker);
m_pImages.pushMat(data);
}
BOOL GScn_Drv::IsConnected()
{
if (m_usb.get())
return m_usb->is_connected();
else
return false;
}
cv::Mat GScn_Drv::Get_Img_Data(UINT32 bufferSize)
{
std::lock_guard<std::mutex> lck(m_Locker);
cv::Mat iData(1, bufferSize, CV_8UC1);
USBCB usbcb = { GET_IMAGE,0,bufferSize };
DWORD transfer;
qDebug("Get_Img_Data write_bulk GET_IMAGE CV_8UC1 \n.....................");
m_usb->write_bulk(&usbcb, sizeof(usbcb));
StopWatch sw;
sw.start();
qDebug("Get_Img_Data Read_Data bufferSize begin \n.....................");
m_usb->read_bulk(iData.data, bufferSize);
sw.stop();
qDebug("GetDate Consume time %lf \n.....................................", sw.time_run());
return iData;
}
void GScn_Drv::run()
{
//m_isScanning=false;
if (m_threadUsb.joinable())
{
m_bRun = false;
devState = DEV_STOP;
m_threadUsb.join();
}
m_bRun = true;
devState = DEV_ISRUNNING;
m_threadUsb = std::thread(&GScn_Drv::usbmain, this);
}
INT GScn_Drv::get_decompress_pix_type()
{
return pixType;
}
void GScn_Drv::set_decompress_pix_type(int pixtype)
{
if (pixtype == TWPT_RGB)//TWPT_RGB=2
{
pixType = TJPF_BGR;
qDebug("TurboJpeg ————————————————————TJPF_BGR\n");
}
else
{
pixType = TJPF_GRAY;
qDebug("TurboJpeg ————————————————————TJPF_GRAY\n");
}
}
void GScn_Drv::SetIsDuplex(BOOL value)
{
isDuplex = value;
}
void GScn_Drv::ActiveteUSB()
{
if (IsConnected())
{
DWORD transfer;
USBCB usbcb = { 1024,0 ,0 };
m_usb->write_bulk(&usbcb, sizeof(usbcb));
}
}
DWORD GScn_Drv::usbmain()
{
//try
{
while (m_bRun)
{
if (devState == DEV_ISRUNNING)
{
if (!IsConnected())
{
Sleep(200);
continue;
}
USBCB usbcb = Get_Scanner_Status();
switch (usbcb.u32_Data)
{
case HAVE_IMAGE:
{
int totalNum = usbcb.u32_Count;
DWORD transferCount = 0;
iNum++;
cv::Mat imgData = Get_Img_Data(totalNum);
switch (m_scannerType)
{
case G100:
case G200:
{
cv::Mat bufferF = imgData.clone();
cv::Mat bufferB = imgData.clone();
int j = 0;
int k = 0;
for (int i = 0; i < totalNum / 1024; i++)
{
if (imgData.data[1023 + i * 1024] == 0)
{
j++;
memcpy(&(bufferB.data[(j - 1) * 1023]), &(imgData.data[(j + k - 1) * 1024]), 1023);
}
else if (imgData.data[1023 + i * 1024] == 255)
{
k++;
memcpy(&(bufferF.data[(k - 1) * 1023]), &(imgData.data[(j + k - 1) * 1024]), 1023);
}
}
auto bufB = JpegBuffer(bufferB, pixType, 0, 0);
auto bufF = JpegBuffer(bufferF, pixType, 1, 0);
pushMat(bufB);
pushMat(bufF);
//校正流程 一次流程,采集两次,共四面(正反)。
static int flatindex = 0;
if (flatMode != -1)
{
flatindex++;
if (flatindex == 2)
{
StopFlat();
if ((flatMode == 0x02) | (flatMode == 0x00))//这里不加睡眠会有点问题
{
this_thread::sleep_for(std::chrono::milliseconds(2000));
}
else
{
this_thread::sleep_for(std::chrono::milliseconds(3000));
}
if (!dpi300GC_dpi200GC.empty())
{
flatindex = 0;
Flat();
}
else
{
devState = DEV_STOP;
flatMode = -1;
m_pImages.SetScanFlag(false);
}
flatindex = 0;
}
}
break;
}
case G300:
case G400:
case G500:
{
auto buf = JpegBuffer(imgData, pixType, 0, 0);
pushMat(buf);
break;
}
default:
break;
}
Pop_Image();
break;
}
case STOP_SCAN:
{
m_onStopQtime();
m_isScanning = false;
devState = DEV_STOP;
m_pImages.SetScanFlag(false);
ntcMsg[usbcb.u32_Data] = "扫描完成";
callbackDevMessge(ntcMsg[usbcb.u32_Data].c_str());
break;
}
case AUTO_FLAT_FINISHED:
{
m_isScanning = false;
devState = DEV_STOP;
callbackDevMessge(ntcMsg[usbcb.u32_Data].c_str());
}
break;
case COUNT_MODE:
case NO_FEED:
case OPEN_COVER:
case FEED_IN_ERROR:
case DETECT_DOUBLE_FEED:
case DETECT_STAPLE:
case PAPER_SKEW:
case HARDWARE_ERROR:
case PC_SCAN_BUSY_or_ERROR:
m_onStopQtime();
callbackDevMessge(ntcMsg[usbcb.u32_Data].c_str());
devState = DEV_WRONG;
m_pImages.SetScanFlag(false);
break;
case NORMAL:
break;
default:
break;
}
this_thread::sleep_for(std::chrono::milliseconds(20));
}
}
return 0;
}
// catch (CMemoryException* e)
// {
// //XdPrint("CMemoryException");
// }
// catch (CFileException* e)
// {
// //XdPrint("CFileException");
// }
// catch (CException* e)
// {
// //XdPrint("CException");
// }
}
///////////////////////////////////////////////////////////////////////////
void GScn_Drv::Config_Scanner(PUSBCB pUSBCB)
{
if (m_usb->is_connected())
{
std::lock_guard<std::mutex> lck(m_imgLocker);
DWORD transfer;
m_usb->write_bulk(pUSBCB, sizeof(USBCB));
}
}
///////////////////////////////////////////////////////////////////////////
void GScn_Drv::Scanner_StartScan(UINT16 count)
{
//count = 0;
qDebug("Scanner_StartScan.............\n");
if (m_usb->is_connected())
{
qDebug("Scanner Isconnected.............\n");
std::lock_guard<std::mutex> lck(m_imgLocker);
DWORD transfer;
USBCB usbcb = { START_COMMAND,count ,0 };
m_usb->write_bulk(&usbcb, sizeof(usbcb));
iNum = 0;
m_pImages.pixType = pixType;
m_pImages.SetDevModel(m_scannerType);
m_pImages.SetFilePath(csPath);
m_pImages.SetPicformat(qsPic_format_name);
m_pImages.run();
m_pImages.SetScanFlag(true);
run();
}
}
///////////////////////////////////////////////////////////////////////////
std::string GScn_Drv::GetFWVersion()
{
if (m_usb->is_connected())
{
std::lock_guard<std::mutex> lck(m_imgLocker);
std::string pFWVersion = " ";
USBCB usbcb = { GET_FW_VERSION,0,0 };
qDebug("Get GetFWVersion");
m_usb->write_bulk(&usbcb, sizeof(usbcb));
QString cslog;
cslog.sprintf("GetFWVersion Read_Data %d", usbcb.u32_Data);
m_usb->read_bulk(&pFWVersion[0], 10);
return pFWVersion;
}
return "";
}
void GScn_Drv::SetFWVersion()
{
if (m_usb->is_connected())
{
std::lock_guard<std::mutex> lck(m_imgLocker);
}
}
void GScn_Drv::SetSerialNum(std::string pvalue)
{
if (m_usb->is_connected())
{
std::lock_guard<std::mutex> lck(m_imgLocker);
USBCB sercmd = { SEND_SERIAL ,0,14 };
m_usb->write_bulk(&sercmd, sizeof(sercmd));
m_usb->write_bulk(&pvalue, pvalue.length());
}
return;
}
int GScn_Drv::GetScanNum()
{
std::lock_guard<std::mutex> lck(m_imgLocker);
USBCB usbcb = { GET_SCANN_NUM,0,4 };
DWORD transfer;
qDebug("Get GetScanNum");
m_usb->write_bulk(&usbcb, sizeof(usbcb));
QString cslog;
//cslog.Format("GetScanNum Read_Data %d",usbcb.u32_Data);
//WriteLog(//cslog);
m_usb->read_bulk(&usbcb, sizeof(usbcb));
return usbcb.u32_Data;
}
void GScn_Drv::ClrRollerNum()
{
std::lock_guard<std::mutex> lck(m_imgLocker);
USBCB usbcb = { CLR_ROLLER_NUM,0,4 };
DWORD transfer;
qDebug("Get ClrRollerNum");
m_usb->write_bulk(&usbcb, sizeof(usbcb));
return;
}
void GScn_Drv::ClrScanNum()
{
std::lock_guard<std::mutex> lck(m_imgLocker);
USBCB usbcb = { CLR_SCAN_NUM,0,4 };
DWORD transfer;
qDebug("Get ClrScanNum");
m_usb->write_bulk(&usbcb, sizeof(usbcb));
return;
}
void GScn_Drv::SendFlatData(CorrectParam param, int index)
{
UsbKeyWords keyword;
switch (index)
{
case 0:
keyword = SEND_COLORCORRECT_FLAT;
break;
case 1:
keyword = SEND_COLOR_FLAT;
break;
case 2:
keyword = SEND_GRAYCORRECT_FLAT;
break;
case 3:
keyword = SEND_GRAY_FLAT;
break;
default:
break;
}
USBCB cmd = { keyword ,0,0 };
m_usb->write_bulk(&cmd, sizeof(cmd));
m_usb->write_bulk(&param, sizeof(param));
}
CaptureParams GScn_Drv::GetFlatData()
{
CaptureParams param = { 0 };
USBCB usbcb = { GET_FLAT_DATA,0,0 };
DWORD transfer;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
m_usb->read_bulk(&param, sizeof(param));
return param;
}
void GScn_Drv::StartFlat()
{
if (!m_usb->is_connected())
return;
USBCB usbcb = { START_FLAT,0,0 };
DWORD transfer;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
if (m_threadUsb.joinable()) {
m_bRun = false;
devState = DEV_STOP;
m_threadUsb.join();
}
m_bRun = true;
devState = DEV_ISRUNNING;
m_threadUsb = std::thread(&GScn_Drv::usbmain, this);
}
void GScn_Drv::StopFlat()
{
if (!m_usb->is_connected())
return;
USBCB usbcb = { STOP_FLAT,0,0 };
m_usb->write_bulk(&usbcb, sizeof(usbcb));
}
void GScn_Drv::DevStateChange() {
devState = DEV_STOP;
}
///////////////////////////////////////////////////////////////////////////
std::string GScn_Drv::GetSerialNum()
{
if (!m_usb.get() && !m_usb->is_connected())
{
return "";
}
std::lock_guard<std::mutex> lck(m_imgLocker);
std::string str;
str.resize(14);
USBCB usbcb = { GET_SERIAL,0,14 };
m_usb->write_bulk(&usbcb, sizeof(usbcb));
///
m_usb->read_bulk(&str[0], 14);
return str;
}
void GScn_Drv::SetRatio(UINT32 tyepe, UINT32 ration)
{
UsbKeyWords keyword = tyepe == 0 ? SET_JUST_COF_H : SET_JUST_COF_V;
USBCB cmd = { keyword ,ration,0 };
m_usb->write_bulk(&cmd, sizeof(cmd));
}
void GScn_Drv::GetRatio(UINT32 type, UINT32& ratio)
{
UsbKeyWords keyword = type == 0 ? GET_JUST_COF_H : GET_JUST_COF_V;
USBCB cmd = { keyword ,0,0 };
m_usb->write_bulk(&cmd, sizeof(cmd));
m_usb->read_bulk(&cmd, sizeof(cmd));
ratio = cmd.u32_Data;
}
void GScn_Drv::Reboot()
{
USBCB cmd = { REBOOT,0,0 };
m_usb->write_bulk(&cmd, sizeof(cmd));
}
///////////////////////////////////////////////////////////////////////////
USBCB GScn_Drv::Get_Scanner_Status()
{
std::lock_guard<std::mutex> lck(m_imgLocker);
if (!m_usb->is_connected())
{
qDebug("Get_Scanner_Status Error\n");
USBCB errorType = { NO_COMMAND ,PC_SCAN_BUSY_or_ERROR ,0 };
return errorType;
}
////XdPrint("Get_Scanner_Status GET_DSP_STATUS write_bulk\n");
USBCB usbcb = { GET_DSP_STATUS ,0,0 };
DWORD transfer;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
qDebug("Get_Scanner_Status Read_Data %d \n", usbcb.u32_Data);
m_usb->read_bulk(&usbcb, sizeof(usbcb));
qDebug("Get_Scanner_Status return usbcb \n", usbcb.u32_Data);
return usbcb;
}
///////////////////////////////////////////////////////////////////////////
bool GScn_Drv::is_scan()
{
return devState == DEV_ISRUNNING;
}
///////////////////////////////////////////////////////////////////////////
BOOL GScn_Drv::Get_Scanner_PaperOn()
{
if (!m_usb->is_connected())
{
return FALSE;
}
USBCB usbcb = { GET_PAPERFEEDER_STATUS ,0,0 };
DWORD transfer;
std::lock_guard<std::mutex> lck(m_imgLocker);
m_usb->write_bulk(&usbcb, sizeof(usbcb));
m_usb->read_bulk(&usbcb, sizeof(usbcb));
return usbcb.u32_Data != 0;
}
///////////////////////////////////////////////////////////////////////////
void GScn_Drv::Pop_Image()
{
if (!m_usb->is_connected())
{
return;
}
std::lock_guard<std::mutex> lck(m_imgLocker);
USBCB usbcb = { POP_IMAGE ,0,0 };
DWORD transfer;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
}
///////////////////////////////////////////////////////////////////////////
void GScn_Drv::Stop_scan()
{
if (!m_usb->is_connected())
{
return;
}
std::lock_guard<std::mutex> lck(m_imgLocker);
USBCB usbcb = { STOP ,0,0 };
DWORD transfer;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
}
void GScn_Drv::ResetScanner()
{
if (!m_usb->is_connected())
return;
std::lock_guard<std::mutex> lck(m_imgLocker);
USBCB usbcb = { INIT_HARDWARE_SYS ,0,0 };
DWORD transfer;
m_usb->write_bulk(&usbcb, sizeof(usbcb));
}
///////////////////////////////////////////////////////////////////////////
bool GScn_Drv::Get_IsImageQueueEmpty()
{
return m_pImages.empty();
}

View File

@ -0,0 +1,409 @@
#pragma once
#include "IUsb.h"
#include <memory>
#include <vector>
#include <string>
#include <queue>
#ifdef WIN32
#include <Windows.h>
#endif
#include <opencv2/highgui/highgui.hpp>
//#include "MutexEx.h"
#include "opencv2/core/core.hpp"
#include "jpeglib.h"
#include <time.h>
#include <thread>
#include <mutex>
#include "ImageMatQueue.h"
#include <map>
#include "PublicFunc.h"
#include <QMessageBox>
using namespace cv;
typedef struct tag_USBCB {
UINT32 u32_CMD;
UINT32 u32_Data;
UINT32 u32_Count;
}USBCB, * PUSBCB;
typedef struct tag_USBCBA4
{
UINT u32_Command; /* command to execute */
UINT u32_Data; /* generic data field */
UINT u32_Count; /* number of bytes to transfer */
byte buffer[512]; //=new byte[1024];
}USBCBA4, * PUSBCBA4;
//u32_CMD
enum tagUsbKeyWords :UINT32
{
NO_COMMAND = 0,
//获取dsp 状态
GET_DSP_STATUS = 1,
//取图
GET_IMAGE = 2,
//销毁DSP中驻存的图
POP_IMAGE = 3,
//开始扫描命令
START_COMMAND = 4,
//停止扫描命令
STOP = 5,
//获取扫描仪扫描模式
GET_SCAN_MODE = 6,
//获取固件版本号
GET_FW_VERSION = 7,
//返回PC端的状态
SEND_STATUS_PC = 8,
//下发扫描配置参数
CONFIGURED_DATA = 9,
//下发固件信息
SEND_FW = 10,
//获取扫描参数
GET_CONFIG_DATA = 11,
//获取扫描总张数
GET_SCANN_NUM = 12,
//获取有无纸的状态
GET_PAPERFEEDER_STATUS = 13,
//DSP初始化
INIT_HARDWARE_SYS = 14,
//下发元器件配置参数灰度LED R曝光时间
SEND_COMPONENTS_GR = 15,
//下发元器件配置参数LED G/B曝光时间
SEND_COMPONENTS_GB = 16,
//下发扫描模式
SEND_SCAN_MODE = 17,
//开始进行平场矫正
START_FLAT = 18,
//停止平场矫正
STOP_FLAT = 19,
//下发200dpi彩色平场矫正参数
SEND_200_COLOR_FLAT_DATA = 20,
//下发300dpi彩色平场矫正参数
SEND_300_COLOR_FLAT_DATA = 21,
//获取200dpi彩色平场矫正参数
GET_200_COLOR_FLAT_DATA = 22,
//获取300dpi彩色平场矫正参数
GET_300_COLOR_FLAT_DATA = 23,
//下发200dpi灰度平场校正参数
SEND_200_GRAY_FLAT_DATA = 24,
//下发300dpi灰度平场校正参数
SEND_300_GRAY_FLAT_DATA = 25,
//获取200DPI灰度平场校正参数
GET_200_GRAY_FLAT_DATA = 26,
//获取300DPI灰度平场校正参数
GET_300_GRAY_FLAT_DATA = 27,
//下发序列号命令
SEND_SERIAL = 28,
//获取序列号命令
GET_SERIAL = 29,
//获取滚轴数
GET_ROLLER_NUM = 0x1e,
//清零滚轴数
CLR_ROLLER_NUM = 0x1f,
//清除扫描总张数
CLR_SCAN_NUM = 0x20,
//准备更新固件
PRE_UPGRADE = 0X21,
//开始更新固件
START_UPGRADE = 0x22,
//彩色的AD参数
RGB_ADI_PARA = 0x23,
//灰度的AD参数
ADI_PARA = 0x24,
//获取CIS参数曝光时间ad参数)
GET_CIS_PARA = 0x25,
//扫描张数
START_COMMAND_COUNT = 0x26,
//下发休眠时间
SET_SLEEP_TIME = 0x27,
//获取休眠时间
GET_SLEEP_TIME = 0x28,
//清除缓存
CLR_CACHE = 0x29,
//下发速度模式
SET_SPEED_MODE = 0x2a,
//获取扫描速度模式
GET_SPEED_MODE = 0X2b,
//设置固件版本一共8个字节
SET_FW_VERSION = 0X2c,
//获取DSP版本
GET_DSP_VERSION = 0X2d,
//采集板FPGA固件版本
GET_SCANFPGA_VERSION = 0x2e,
//电机板FPGA固件版本
GET_MOTORFPGA_VERSION = 0X2f,
//设置制造商信息
SET_USB_INFOR_MANUFACTURE = 0X30,
//获取制造商信息
GET_USB_INFOR_MANUFACTURE = 0X31,
//设置产品型号信息
SET_USB_INFOR_MODEL_NAME = 0X32,
//获取产品型号信息
GET_USB_INFOR_MODEL_NAME = 0X33,
//设置USB PID / VID信息
SET_USB_INFOR_VIDPID = 0X34,
GET_USB_INFOR_VIDPID = 0X35,
//设置卡纸急停检测灵敏度
SET_JAM_DETECT_SENSITIVE = 0X36,
//获取卡纸急停检测灵敏度
GET_JAM_DETECT_SENSITIVE = 0X37,
//设置横向畸变系数
SET_JUST_COF_H = 0x38,
//读取横向畸变系数
GET_JUST_COF_H = 0x39,
//G400 清除硬件异常
CLEAR_HWERROR = 0x40,
//设置纵向畸变系数
SET_JUST_COF_V = 0x41,
//读取纵向畸变系数
GET_JUST_COF_V = 0x42,
//设置彩色校正参数
SEND_COLOR_FLAT = 0x43,
//设置彩色平场校正参数
SEND_COLORCORRECT_FLAT = 0x44,
//设置灰度校正参数
SEND_GRAY_FLAT = 0x45,
//设置灰度平场校正参数
SEND_GRAYCORRECT_FLAT = 0x46,
//设置平场校正参数
GET_FLAT_DATA = 0x47,
//更新完成
UPDATE_FINISHED = 0x48,
//
REBOOT = 0x49,
GET_LOG_FILES_INFO = 0x50,
//发送log文件完成
GET_UPDATE_RESULT = 0x51,
//清空日志
CLEAR_LOG_FILES = 0x52,
//获取搓纸失败
GET_CUO_ERROR,
//获取双张失败次数
GET_DOU_ERROR,
//获取卡纸次数
GET_JAM_ERROR,
GET_UV_EXPOSA = 0x100,
GET_UV_EXPOSB = 0x101,
SET_UV_EXPOSA = 0x102,
SET_UV_EXPOSB = 0x103
};
typedef enum tagUsbKeyWords UsbKeyWords, * PUsbKeyWords;
//u32_Data
enum tagUsbSupported
{
//停止扫描
SCAN_STOP = -2,
//异常
HAVE_ERROR = -1,
//正常状态
NORMAL = 0,
//开盖
OPEN_COVER = 1,
// 无纸
NO_FEED = 2,
// 搓纸失败
FEED_IN_ERROR = 4,
// 卡纸
PAPER_JAM = 8,
// 检测到双张
DETECT_DOUBLE_FEED = 16,
// 检测到订书钉
DETECT_STAPLE = 32,
// 纸张倾斜
PAPER_SKEW = 64,
// 自动模式
AUTO_SCAN_MODE = 65,
// 手动模式
MANAUL_SCAN_MODE = 66,
// 计数模式
COUNT_MODE = 67,
// 硬件错误
HARDWARE_ERROR = 68,
// FPGA崩溃
FPGA_ERROR = 68,
// 开始
START_SCAN = 69,
//停止
STOP_SCAN = 70,
//有图
HAVE_IMAGE = 71,
// 更新扫描参数
UPDATE_SCAN_PARAMETER = 72,
// PC繁忙或出错
PC_SCAN_BUSY_or_ERROR = 73,
// 更新完成
STS_UPDATE_FINISHED = 74,
//USB 未连接
USB_DISCONNECTED = 200,
//用户点击停止
USER_STOP = 201,
//自动平场校正完成
AUTO_FLAT_FINISHED = 202
};
typedef enum tagUsbSupported UsbSupported, * PUsbSupported;
enum tagDevState
{
DEV_STOP = -1,
DEV_ISRUNNING,
DEV_WRONG
};
typedef enum tagDevState DevState, PDevState;
enum tagEventIndex
{
EVENT_IMAGE,
EVENT_NUM
};
enum tagDEVMODEL
{
G100 = 0,
G200,
G300,
G400,
G500
};
class GScn_Drv
{
public:
GScn_Drv();
~GScn_Drv();
void open(int vid, int pid, int index, int scannerType);
int aquire_image(QString& image, int num);
BOOL IsConnected();
std::string GetFWVersion();
void SetFWVersion();
std::string GetSerialNum();
void SetRatio(UINT32 tyepe, UINT32 ration);
void GetRatio(UINT32 type, UINT32& ratio);
void Reboot();
bool is_scan();
USBCB Get_Scanner_Status();
BOOL Get_Scanner_PaperOn();
void Config_Scanner(PUSBCB pUSBCB);
void Scanner_StartScan(UINT16 count);
void Stop_scan();
void ResetScanner();
bool Get_IsImageQueueEmpty();
void reset();
void run();
INT get_decompress_pix_type();
void set_decompress_pix_type(int pixtype);
void SetIsDuplex(BOOL value);
void ActiveteUSB();
void SetSerialNum(std::string pvalue);
int GetScanNum();
void ClrRollerNum();
void ClrScanNum();
void SendFlatData(CorrectParam param, int index);
CaptureParams GetFlatData();
void StartFlat();
void StopFlat();
void DevStateChange();
int getMatSum();
void close();
void GetExpose(UINT32& Aside, UINT32& Bside);
void SetExpose(UINT32 aside, UINT32 bside);
void GetSptime(UINT32 type, UINT32& time);
void SetSptime(UINT32 type, UINT32 time);
void GetSleepTime(UINT32& sleeptime);
void SetSleepTime(UINT32 sleeptime);
void GetSpeedMode(UINT32& speedmode);
void SetSpeedMode(UINT32 speedmode);
void SetG100G200CorrecPara(UINT32 Para,int);
void GetG100G200CorrecPara(unsigned char* parm, int a);
void SetPath(QString csFilePath)
{
csPath = csFilePath;
}
void Setformat(QString formatName)
{
qsPic_format_name = formatName;
}
QString GetPath()
{
return csPath;
}
ImageMatQueue m_pImages;
std::shared_ptr<IUsb> m_usb;
void stopTime(std::function<void()> onStop);
void retdevMessges(std::function<void(const char* ptr)> devMessges);
//选择校正的模式 dpi 200or300 Gray OR Color
int ModeSelection(list<int>& dpi300GC_dpi200GC);
void Flat();
std::list<int> dpi300GC_dpi200GC;
string str1;
private:
volatile int devState;
volatile bool m_bRun;
volatile BOOL isDuplex;
std::mutex m_Locker;
std::mutex m_imgLocker;
int pixType;
int flatMode; //接收校正选项
std::thread m_threadUsb;
std::map<int, string> ntcMsg;
std::map<string, int> devType;
std::vector<string> vcSerials;
int selectDeviceIndex;
int m_scannerType;
bool m_isScanning;
QString csPath;
QString qsPic_format_name;
std::function<void()> m_onStopQtime;
std::function<void(const char *ptr)> callbackDevMessge;
char *usbcbDate;
private:
QString popMat(int num);
void pushMat(JpegBuffer& data);
void InitMSGMap();
void InitScannerDiviceMap();
cv::Mat Get_Img_Data(UINT32 buffersize);
DWORD usbmain();
void Pop_Image();
};

View File

@ -0,0 +1,41 @@
#include "stdafx.h"
#include "imageprocess.h"
vector<uchar> histogram_bit8(uchar* data, int rows, int cols)
{
vector<int> hist_sum(static_cast<uint>(cols));
vector<uchar> hist(static_cast<uint>(cols));
for (int x = 0; x < cols; ++x)
{
for (int y = 0; y < rows; ++y)
{
hist_sum[static_cast<uint>(x)] += data[static_cast<uint>(y * cols + x)];
}
hist[static_cast<uint>(x)] = static_cast<uchar>(hist_sum[static_cast<uint>(x)] / rows);
}
return hist;
}
void histogram_bit32(uchar* data, int rows, int cols, vector<uchar>& r, vector<uchar>& g, vector<uchar>& b)
{
uint total = static_cast<uint>(rows * cols);
uchar* buffer_r = new uchar[total];
uchar* buffer_g = new uchar[total];
uchar* buffer_b = new uchar[total];
for (uint i = 0; i < total; ++i)
{
buffer_r[i] = data[i * 3 + 0];
buffer_g[i] = data[i * 3 + 1];
buffer_b[i] = data[i * 3 + 2];
}
r = histogram_bit8(buffer_r, rows, cols);
g = histogram_bit8(buffer_g, rows, cols);
b = histogram_bit8(buffer_b, rows, cols);
delete[] buffer_r;
delete[] buffer_g;
delete[] buffer_b;
}

View File

@ -0,0 +1,15 @@
#ifndef IMAGEPROCESS_H
#define IMAGEPROCESS_H
#include <vector>
using namespace std;
typedef unsigned char uchar;
typedef unsigned int uint;
vector<uchar> histogram_bit8(uchar* data, int rows, int cols = 3456);
void histogram_bit32(uchar* data, int rows, int cols, vector<uchar>& r, vector<uchar>& g, vector<uchar>& b);
#endif // IMAGEPROCESS_H

View File

@ -0,0 +1,71 @@
#include "stdafx.h"
#include "jpeglib.h"
JpegLib::JpegLib()
:img_buffer(NULL), sizeBuffer(0)
{
handle = std::shared_ptr<void> (tjInitDecompress(),tjDestroy);
}
JpegLib::~JpegLib()
{
clear();
}
void JpegLib::clear()
{
img_buffer.reset();
sizeBuffer = 0;
}
cv::Mat JpegLib::decode(cv::Mat& buf, int pixelFormat)
{
if(buf.rows != 1)
return cv::Mat();
//XdPrint("==============decode cols is :%d ============\n",buf.cols);
decode(buf.data, buf.cols, pixelFormat);
return cv::Mat(getHeight(), getWidth() , pixelFormat == TJPF_BGR ? CV_8UC3 : CV_8UC1, getData());
}
void JpegLib::decode(unsigned char* buff, unsigned long buff_size, int pixelFormat)
{
tjDecompressHeader(handle.get(), buff, buff_size, &width, &height);
//XdPrint("==============tjDecompressHeader width is :%d height is : %d ============\n",width , height);
int size = width * height *tjPixelSize[pixelFormat];
if (sizeBuffer != size)
{
clear();
img_buffer = std::shared_ptr<unsigned char>(tjAlloc(size), tjFree);
sizeBuffer = size;
}
if (img_buffer)
{
//XdPrint("==============img_buffer buff_size is :%d ============\n",buff_size);
tjDecompress2(handle.get(), buff, buff_size, img_buffer.get(), width, 0, height, pixelFormat, 0);
//XdPrint("============== tjDecompress2 finish ============\n",buff_size);
}
}
int JpegLib::getWidth()
{
return width;
}
int JpegLib::getHeight()
{
return height;
}
int JpegLib::getBufferSize()
{
return sizeBuffer;
}
unsigned char* JpegLib::getData()
{
return img_buffer.get();
}

View File

@ -0,0 +1,26 @@
#pragma once
#include "turbojpeg.h"
#include <memory>
#include <opencv2/opencv.hpp>
class JpegLib
{
public:
JpegLib();
~JpegLib();
void clear();
cv::Mat decode(cv::Mat& buf, int pixelFormat);
void decode(unsigned char* buff, unsigned long buff_size, int pixelFormat);
int getWidth();
int getHeight();
int getBufferSize();
unsigned char* getData();
private:
std::shared_ptr<void> handle;
std::shared_ptr<unsigned char> img_buffer;
int sizeBuffer;
int width;
int height;
};

22875
qt-correction-tool/json.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
#include "widget.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}

View File

@ -0,0 +1,2 @@
chcp 65001
"E:\Qt\Qt5.14.0\Tools\QtCreator\bin\jom.exe" %*

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,170 @@
#ifndef EXDISPID_H_
//+-------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: exdispid.h
//
//--------------------------------------------------------------------------
//
// Dispatch IDS for IExplorer Dispatch Events.
//
#define DISPID_BEFORENAVIGATE 100 // this is sent before navigation to give a chance to abort
#define DISPID_NAVIGATECOMPLETE 101 // in async, this is sent when we have enough to show
#define DISPID_STATUSTEXTCHANGE 102
#define DISPID_QUIT 103
#define DISPID_DOWNLOADCOMPLETE 104
#define DISPID_COMMANDSTATECHANGE 105
#define DISPID_DOWNLOADBEGIN 106
#define DISPID_NEWWINDOW 107 // sent when a new window should be created
#define DISPID_PROGRESSCHANGE 108 // sent when download progress is updated
#define DISPID_WINDOWMOVE 109 // sent when main window has been moved
#define DISPID_WINDOWRESIZE 110 // sent when main window has been sized
#define DISPID_WINDOWACTIVATE 111 // sent when main window has been activated
#define DISPID_PROPERTYCHANGE 112 // sent when the PutProperty method is called
#define DISPID_TITLECHANGE 113 // sent when the document title changes
#define DISPID_TITLEICONCHANGE 114 // sent when the top level window icon may have changed.
#define DISPID_FRAMEBEFORENAVIGATE 200
#define DISPID_FRAMENAVIGATECOMPLETE 201
#define DISPID_FRAMENEWWINDOW 204
#define DISPID_BEFORENAVIGATE2 250 // hyperlink clicked on
#define DISPID_NEWWINDOW2 251
#define DISPID_NAVIGATECOMPLETE2 252 // UIActivate new document
#define DISPID_ONQUIT 253
#define DISPID_ONVISIBLE 254 // sent when the window goes visible/hidden
#define DISPID_ONTOOLBAR 255 // sent when the toolbar should be shown/hidden
#define DISPID_ONMENUBAR 256 // sent when the menubar should be shown/hidden
#define DISPID_ONSTATUSBAR 257 // sent when the statusbar should be shown/hidden
#define DISPID_ONFULLSCREEN 258 // sent when kiosk mode should be on/off
#define DISPID_DOCUMENTCOMPLETE 259 // new document goes ReadyState_Complete
#define DISPID_ONTHEATERMODE 260 // sent when theater mode should be on/off
#define DISPID_ONADDRESSBAR 261 // sent when the address bar should be shown/hidden
#define DISPID_WINDOWSETRESIZABLE 262 // sent to set the style of the host window frame
#define DISPID_WINDOWCLOSING 263 // sent before script window.close closes the window
#define DISPID_WINDOWSETLEFT 264 // sent when the put_left method is called on the WebOC
#define DISPID_WINDOWSETTOP 265 // sent when the put_top method is called on the WebOC
#define DISPID_WINDOWSETWIDTH 266 // sent when the put_width method is called on the WebOC
#define DISPID_WINDOWSETHEIGHT 267 // sent when the put_height method is called on the WebOC
#define DISPID_CLIENTTOHOSTWINDOW 268 // sent during window.open to request conversion of dimensions
#define DISPID_SETSECURELOCKICON 269 // sent to suggest the appropriate security icon to show
#define DISPID_FILEDOWNLOAD 270 // Fired to indicate the File Download dialog is opening
#define DISPID_NAVIGATEERROR 271 // Fired to indicate the a binding error has occured
#define DISPID_PRIVACYIMPACTEDSTATECHANGE 272 // Fired when the user's browsing experience is impacted
#define DISPID_NEWWINDOW3 273
#define DISPID_VIEWUPDATE 281 // Fired when the contents of a shell browser window change
#define DISPID_SETPHISHINGFILTERSTATUS 282 // Fired by the Phishing Filter API to signal what state the analysis is in
#define DISPID_WINDOWSTATECHANGED 283 // Fired to indicate that the browser window's visibility or enabled state has changed
#define DISPID_NEWPROCESS 284 // Fired when a navigation must be redirected due to Protected Mode
#define DISPID_THIRDPARTYURLBLOCKED 285 // Fired when a third-party url is blocked due to Privacy Advisor
#define DISPID_REDIRECTXDOMAINBLOCKED 286 // Fired when a x-domain redirect is blocked due to browser nav constant
// Printing events
#define DISPID_PRINTTEMPLATEINSTANTIATION 225 // Fired to indicate that a print template is instantiated
#define DISPID_PRINTTEMPLATETEARDOWN 226 // Fired to indicate that a print templete is completely gone
#define DISPID_UPDATEPAGESTATUS 227 // Fired to indicate that the spooling status has changed
// define the events for the shell window list
#define DISPID_WINDOWREGISTERED 200 // Window registered
#define DISPID_WINDOWREVOKED 201 // Window Revoked
#define DISPID_RESETFIRSTBOOTMODE 1
#define DISPID_RESETSAFEMODE 2
#define DISPID_REFRESHOFFLINEDESKTOP 3
#define DISPID_ADDFAVORITE 4
#define DISPID_ADDCHANNEL 5
#define DISPID_ADDDESKTOPCOMPONENT 6
#define DISPID_ISSUBSCRIBED 7
#define DISPID_NAVIGATEANDFIND 8
#define DISPID_IMPORTEXPORTFAVORITES 9
#define DISPID_AUTOCOMPLETESAVEFORM 10
#define DISPID_AUTOSCAN 11
#define DISPID_AUTOCOMPLETEATTACH 12
#define DISPID_SHOWBROWSERUI 13
#define DISPID_ADDSEARCHPROVIDER 14
#define DISPID_RUNONCESHOWN 15
#define DISPID_SKIPRUNONCE 16
#define DISPID_CUSTOMIZESETTINGS 17
#define DISPID_SQMENABLED 18
#define DISPID_PHISHINGENABLED 19
#define DISPID_BRANDIMAGEURI 20
#define DISPID_SKIPTABSWELCOME 21
#define DISPID_DIAGNOSECONNECTION 22
#define DISPID_CUSTOMIZECLEARTYPE 23
#define DISPID_ISSEARCHPROVIDERINSTALLED 24
#define DISPID_ISSEARCHMIGRATED 25
#define DISPID_DEFAULTSEARCHPROVIDER 26
#define DISPID_RUNONCEREQUIREDSETTINGSCOMPLETE 27
#define DISPID_RUNONCEHASSHOWN 28
#define DISPID_SEARCHGUIDEURL 29
#define DISPID_ADDSERVICE 30
#define DISPID_ISSERVICEINSTALLED 31
#define DISPID_ADDTOFAVORITESBAR 32
#define DISPID_BUILDNEWTABPAGE 33
#define DISPID_SETRECENTLYCLOSEDVISIBLE 34
#define DISPID_SETACTIVITIESVISIBLE 35
#define DISPID_CONTENTDISCOVERYRESET 36
#define DISPID_INPRIVATEFILTERINGENABLED 37
#define DISPID_SUGGESTEDSITESENABLED 38
#define DISPID_ENABLESUGGESTEDSITES 39
#define DISPID_NAVIGATETOSUGGESTEDSITES 40
#define DISPID_SHOWTABSHELP 41
#define DISPID_SHOWINPRIVATEHELP 42
#define DISPID_SHELLUIHELPERLAST 43
#define DISPID_ADVANCEERROR 10
#define DISPID_RETREATERROR 11
#define DISPID_CANADVANCEERROR 12
#define DISPID_CANRETREATERROR 13
#define DISPID_GETERRORLINE 14
#define DISPID_GETERRORCHAR 15
#define DISPID_GETERRORCODE 16
#define DISPID_GETERRORMSG 17
#define DISPID_GETERRORURL 18
#define DISPID_GETDETAILSSTATE 19
#define DISPID_SETDETAILSSTATE 20
#define DISPID_GETPERERRSTATE 21
#define DISPID_SETPERERRSTATE 22
#define DISPID_GETALWAYSSHOWLOCKSTATE 23
// Dispatch IDS for ShellFavoritesNameSpace Dispatch Events.
//
#define DISPID_FAVSELECTIONCHANGE 1
#define DISPID_SELECTIONCHANGE 2
#define DISPID_DOUBLECLICK 3
#define DISPID_INITIALIZED 4
#define DISPID_MOVESELECTIONUP 1
#define DISPID_MOVESELECTIONDOWN 2
#define DISPID_RESETSORT 3
#define DISPID_NEWFOLDER 4
#define DISPID_SYNCHRONIZE 5
#define DISPID_IMPORT 6
#define DISPID_EXPORT 7
#define DISPID_INVOKECONTEXTMENU 8
#define DISPID_MOVESELECTIONTO 9
#define DISPID_SUBSCRIPTIONSENABLED 10
#define DISPID_CREATESUBSCRIPTION 11
#define DISPID_DELETESUBSCRIPTION 12
#define DISPID_SETROOT 13
#define DISPID_ENUMOPTIONS 14
#define DISPID_SELECTEDITEM 15
#define DISPID_ROOT 16
#define DISPID_DEPTH 17
#define DISPID_MODE 18
#define DISPID_FLAGS 19
#define DISPID_TVFLAGS 20
#define DISPID_NSCOLUMNS 21
#define DISPID_COUNTVIEWTYPES 22
#define DISPID_SETVIEWTYPE 23
#define DISPID_SELECTEDITEMS 24
#define DISPID_EXPAND 25
#define DISPID_UNSELECTALL 26
#define EXDISPID_H_
#endif // EXDISPID_H_

View File

@ -0,0 +1,655 @@
/*
scarderr.mc
Error message codes from the Smart Card Resource Manager
These messages must be reconciled with winerror.w
They exist here to provide error messages on pre-Win2K systems.
*/
#ifndef SCARD_S_SUCCESS
//
// =============================
// Facility SCARD Error Messages
// =============================
//
#define SCARD_S_SUCCESS NO_ERROR
//
// Values are 32 bit values laid out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
#define FACILITY_SYSTEM 0x0
#define FACILITY_SCARD 0x10
//
// Define the severity codes
//
#define STATUS_SEVERITY_WARNING 0x2
#define STATUS_SEVERITY_INFORMATIONAL 0x1
#define STATUS_SEVERITY_ERROR 0x3
//
// MessageId: SCARD_F_INTERNAL_ERROR
//
// MessageText:
//
// An internal consistency check failed.
//
#define SCARD_F_INTERNAL_ERROR ((DWORD)0x80100001L)
//
// MessageId: SCARD_E_CANCELLED
//
// MessageText:
//
// The action was cancelled by an SCardCancel request.
//
#define SCARD_E_CANCELLED ((DWORD)0x80100002L)
//
// MessageId: SCARD_E_INVALID_HANDLE
//
// MessageText:
//
// The supplied handle was invalid.
//
#define SCARD_E_INVALID_HANDLE ((DWORD)0x80100003L)
//
// MessageId: SCARD_E_INVALID_PARAMETER
//
// MessageText:
//
// One or more of the supplied parameters could not be properly interpreted.
//
#define SCARD_E_INVALID_PARAMETER ((DWORD)0x80100004L)
//
// MessageId: SCARD_E_INVALID_TARGET
//
// MessageText:
//
// Registry startup information is missing or invalid.
//
#define SCARD_E_INVALID_TARGET ((DWORD)0x80100005L)
//
// MessageId: SCARD_E_NO_MEMORY
//
// MessageText:
//
// Not enough memory available to complete this command.
//
#define SCARD_E_NO_MEMORY ((DWORD)0x80100006L)
//
// MessageId: SCARD_F_WAITED_TOO_LONG
//
// MessageText:
//
// An internal consistency timer has expired.
//
#define SCARD_F_WAITED_TOO_LONG ((DWORD)0x80100007L)
//
// MessageId: SCARD_E_INSUFFICIENT_BUFFER
//
// MessageText:
//
// The data buffer to receive returned data is too small for the returned data.
//
#define SCARD_E_INSUFFICIENT_BUFFER ((DWORD)0x80100008L)
//
// MessageId: SCARD_E_UNKNOWN_READER
//
// MessageText:
//
// The specified reader name is not recognized.
//
#define SCARD_E_UNKNOWN_READER ((DWORD)0x80100009L)
//
// MessageId: SCARD_E_TIMEOUT
//
// MessageText:
//
// The user-specified timeout value has expired.
//
#define SCARD_E_TIMEOUT ((DWORD)0x8010000AL)
//
// MessageId: SCARD_E_SHARING_VIOLATION
//
// MessageText:
//
// The smart card cannot be accessed because of other connections outstanding.
//
#define SCARD_E_SHARING_VIOLATION ((DWORD)0x8010000BL)
//
// MessageId: SCARD_E_NO_SMARTCARD
//
// MessageText:
//
// The operation requires a Smart Card, but no Smart Card is currently in the device.
//
#define SCARD_E_NO_SMARTCARD ((DWORD)0x8010000CL)
//
// MessageId: SCARD_E_UNKNOWN_CARD
//
// MessageText:
//
// The specified smart card name is not recognized.
//
#define SCARD_E_UNKNOWN_CARD ((DWORD)0x8010000DL)
//
// MessageId: SCARD_E_CANT_DISPOSE
//
// MessageText:
//
// The system could not dispose of the media in the requested manner.
//
#define SCARD_E_CANT_DISPOSE ((DWORD)0x8010000EL)
//
// MessageId: SCARD_E_PROTO_MISMATCH
//
// MessageText:
//
// The requested protocols are incompatible with the protocol currently in use with the smart card.
//
#define SCARD_E_PROTO_MISMATCH ((DWORD)0x8010000FL)
//
// MessageId: SCARD_E_NOT_READY
//
// MessageText:
//
// The reader or smart card is not ready to accept commands.
//
#define SCARD_E_NOT_READY ((DWORD)0x80100010L)
//
// MessageId: SCARD_E_INVALID_VALUE
//
// MessageText:
//
// One or more of the supplied parameters values could not be properly interpreted.
//
#define SCARD_E_INVALID_VALUE ((DWORD)0x80100011L)
//
// MessageId: SCARD_E_SYSTEM_CANCELLED
//
// MessageText:
//
// The action was cancelled by the system, presumably to log off or shut down.
//
#define SCARD_E_SYSTEM_CANCELLED ((DWORD)0x80100012L)
//
// MessageId: SCARD_F_COMM_ERROR
//
// MessageText:
//
// An internal communications error has been detected.
//
#define SCARD_F_COMM_ERROR ((DWORD)0x80100013L)
//
// MessageId: SCARD_F_UNKNOWN_ERROR
//
// MessageText:
//
// An internal error has been detected, but the source is unknown.
//
#define SCARD_F_UNKNOWN_ERROR ((DWORD)0x80100014L)
//
// MessageId: SCARD_E_INVALID_ATR
//
// MessageText:
//
// An ATR obtained from the registry is not a valid ATR string.
//
#define SCARD_E_INVALID_ATR ((DWORD)0x80100015L)
//
// MessageId: SCARD_E_NOT_TRANSACTED
//
// MessageText:
//
// An attempt was made to end a non-existent transaction.
//
#define SCARD_E_NOT_TRANSACTED ((DWORD)0x80100016L)
//
// MessageId: SCARD_E_READER_UNAVAILABLE
//
// MessageText:
//
// The specified reader is not currently available for use.
//
#define SCARD_E_READER_UNAVAILABLE ((DWORD)0x80100017L)
//
// MessageId: SCARD_P_SHUTDOWN
//
// MessageText:
//
// The operation has been aborted to allow the server application to exit.
//
#define SCARD_P_SHUTDOWN ((DWORD)0x80100018L)
//
// MessageId: SCARD_E_PCI_TOO_SMALL
//
// MessageText:
//
// The PCI Receive buffer was too small.
//
#define SCARD_E_PCI_TOO_SMALL ((DWORD)0x80100019L)
//
// MessageId: SCARD_E_READER_UNSUPPORTED
//
// MessageText:
//
// The reader driver does not meet minimal requirements for support.
//
#define SCARD_E_READER_UNSUPPORTED ((DWORD)0x8010001AL)
//
// MessageId: SCARD_E_DUPLICATE_READER
//
// MessageText:
//
// The reader driver did not produce a unique reader name.
//
#define SCARD_E_DUPLICATE_READER ((DWORD)0x8010001BL)
//
// MessageId: SCARD_E_CARD_UNSUPPORTED
//
// MessageText:
//
// The smart card does not meet minimal requirements for support.
//
#define SCARD_E_CARD_UNSUPPORTED ((DWORD)0x8010001CL)
//
// MessageId: SCARD_E_NO_SERVICE
//
// MessageText:
//
// The Smart card resource manager is not running.
//
#define SCARD_E_NO_SERVICE ((DWORD)0x8010001DL)
//
// MessageId: SCARD_E_SERVICE_STOPPED
//
// MessageText:
//
// The Smart card resource manager has shut down.
//
#define SCARD_E_SERVICE_STOPPED ((DWORD)0x8010001EL)
//
// MessageId: SCARD_E_UNEXPECTED
//
// MessageText:
//
// An unexpected card error has occurred.
//
#define SCARD_E_UNEXPECTED ((DWORD)0x8010001FL)
//
// MessageId: SCARD_E_ICC_INSTALLATION
//
// MessageText:
//
// No Primary Provider can be found for the smart card.
//
#define SCARD_E_ICC_INSTALLATION ((DWORD)0x80100020L)
//
// MessageId: SCARD_E_ICC_CREATEORDER
//
// MessageText:
//
// The requested order of object creation is not supported.
//
#define SCARD_E_ICC_CREATEORDER ((DWORD)0x80100021L)
//
// MessageId: SCARD_E_UNSUPPORTED_FEATURE
//
// MessageText:
//
// This smart card does not support the requested feature.
//
#define SCARD_E_UNSUPPORTED_FEATURE ((DWORD)0x80100022L)
//
// MessageId: SCARD_E_DIR_NOT_FOUND
//
// MessageText:
//
// The identified directory does not exist in the smart card.
//
#define SCARD_E_DIR_NOT_FOUND ((DWORD)0x80100023L)
//
// MessageId: SCARD_E_FILE_NOT_FOUND
//
// MessageText:
//
// The identified file does not exist in the smart card.
//
#define SCARD_E_FILE_NOT_FOUND ((DWORD)0x80100024L)
//
// MessageId: SCARD_E_NO_DIR
//
// MessageText:
//
// The supplied path does not represent a smart card directory.
//
#define SCARD_E_NO_DIR ((DWORD)0x80100025L)
//
// MessageId: SCARD_E_NO_FILE
//
// MessageText:
//
// The supplied path does not represent a smart card file.
//
#define SCARD_E_NO_FILE ((DWORD)0x80100026L)
//
// MessageId: SCARD_E_NO_ACCESS
//
// MessageText:
//
// Access is denied to this file.
//
#define SCARD_E_NO_ACCESS ((DWORD)0x80100027L)
//
// MessageId: SCARD_E_WRITE_TOO_MANY
//
// MessageText:
//
// The smartcard does not have enough memory to store the information.
//
#define SCARD_E_WRITE_TOO_MANY ((DWORD)0x80100028L)
//
// MessageId: SCARD_E_BAD_SEEK
//
// MessageText:
//
// There was an error trying to set the smart card file object pointer.
//
#define SCARD_E_BAD_SEEK ((DWORD)0x80100029L)
//
// MessageId: SCARD_E_INVALID_CHV
//
// MessageText:
//
// The supplied PIN is incorrect.
//
#define SCARD_E_INVALID_CHV ((DWORD)0x8010002AL)
//
// MessageId: SCARD_E_UNKNOWN_RES_MNG
//
// MessageText:
//
// An unrecognized error code was returned from a layered component.
//
#define SCARD_E_UNKNOWN_RES_MNG ((DWORD)0x8010002BL)
//
// MessageId: SCARD_E_NO_SUCH_CERTIFICATE
//
// MessageText:
//
// The requested certificate does not exist.
//
#define SCARD_E_NO_SUCH_CERTIFICATE ((DWORD)0x8010002CL)
//
// MessageId: SCARD_E_CERTIFICATE_UNAVAILABLE
//
// MessageText:
//
// The requested certificate could not be obtained.
//
#define SCARD_E_CERTIFICATE_UNAVAILABLE ((DWORD)0x8010002DL)
//
// MessageId: SCARD_E_NO_READERS_AVAILABLE
//
// MessageText:
//
// Cannot find a smart card reader.
//
#define SCARD_E_NO_READERS_AVAILABLE ((DWORD)0x8010002EL)
//
// MessageId: SCARD_E_COMM_DATA_LOST
//
// MessageText:
//
// A communications error with the smart card has been detected. Retry the operation.
//
#define SCARD_E_COMM_DATA_LOST ((DWORD)0x8010002FL)
//
// MessageId: SCARD_E_NO_KEY_CONTAINER
//
// MessageText:
//
// The requested key container does not exist on the smart card.
//
#define SCARD_E_NO_KEY_CONTAINER ((DWORD)0x80100030L)
//
// MessageId: SCARD_E_SERVER_TOO_BUSY
//
// MessageText:
//
// The Smart card resource manager is too busy to complete this operation.
//
#define SCARD_E_SERVER_TOO_BUSY ((DWORD)0x80100031L)
//
// MessageId: SCARD_E_PIN_CACHE_EXPIRED
//
// MessageText:
//
// The smart card PIN cache has expired.
//
#define SCARD_E_PIN_CACHE_EXPIRED ((DWORD)0x80100032L)
//
// MessageId: SCARD_E_NO_PIN_CACHE
//
// MessageText:
//
// The smart card PIN cannot be cached.
//
#define SCARD_E_NO_PIN_CACHE ((DWORD)0x80100033L)
//
// MessageId: SCARD_E_READ_ONLY_CARD
//
// MessageText:
//
// The smart card is read only and cannot be written to.
//
#define SCARD_E_READ_ONLY_CARD ((DWORD)0x80100034L)
//
// These are warning codes.
//
//
// MessageId: SCARD_W_UNSUPPORTED_CARD
//
// MessageText:
//
// The reader cannot communicate with the smart card, due to ATR configuration conflicts.
//
#define SCARD_W_UNSUPPORTED_CARD ((DWORD)0x80100065L)
//
// MessageId: SCARD_W_UNRESPONSIVE_CARD
//
// MessageText:
//
// The smart card is not responding to a reset.
//
#define SCARD_W_UNRESPONSIVE_CARD ((DWORD)0x80100066L)
//
// MessageId: SCARD_W_UNPOWERED_CARD
//
// MessageText:
//
// Power has been removed from the smart card, so that further communication is not possible.
//
#define SCARD_W_UNPOWERED_CARD ((DWORD)0x80100067L)
//
// MessageId: SCARD_W_RESET_CARD
//
// MessageText:
//
// The smart card has been reset, so any shared state information is invalid.
//
#define SCARD_W_RESET_CARD ((DWORD)0x80100068L)
//
// MessageId: SCARD_W_REMOVED_CARD
//
// MessageText:
//
// The smart card has been removed, so that further communication is not possible.
//
#define SCARD_W_REMOVED_CARD ((DWORD)0x80100069L)
//
// MessageId: SCARD_W_SECURITY_VIOLATION
//
// MessageText:
//
// Access was denied because of a security violation.
//
#define SCARD_W_SECURITY_VIOLATION ((DWORD)0x8010006AL)
//
// MessageId: SCARD_W_WRONG_CHV
//
// MessageText:
//
// The card cannot be accessed because the wrong PIN was presented.
//
#define SCARD_W_WRONG_CHV ((DWORD)0x8010006BL)
//
// MessageId: SCARD_W_CHV_BLOCKED
//
// MessageText:
//
// The card cannot be accessed because the maximum number of PIN entry attempts has been reached.
//
#define SCARD_W_CHV_BLOCKED ((DWORD)0x8010006CL)
//
// MessageId: SCARD_W_EOF
//
// MessageText:
//
// The end of the smart card file has been reached.
//
#define SCARD_W_EOF ((DWORD)0x8010006DL)
//
// MessageId: SCARD_W_CANCELLED_BY_USER
//
// MessageText:
//
// The action was cancelled by the user.
//
#define SCARD_W_CANCELLED_BY_USER ((DWORD)0x8010006EL)
//
// MessageId: SCARD_W_CARD_NOT_AUTHENTICATED
//
// MessageText:
//
// No PIN was presented to the smart card.
//
#define SCARD_W_CARD_NOT_AUTHENTICATED ((DWORD)0x8010006FL)
//
// MessageId: SCARD_W_CACHE_ITEM_NOT_FOUND
//
// MessageText:
//
// The requested item could not be found in the cache.
//
#define SCARD_W_CACHE_ITEM_NOT_FOUND ((DWORD)0x80100070L)
//
// MessageId: SCARD_W_CACHE_ITEM_STALE
//
// MessageText:
//
// The requested cache item is too old and was deleted from the cache.
//
#define SCARD_W_CACHE_ITEM_STALE ((DWORD)0x80100071L)
//
// MessageId: SCARD_W_CACHE_ITEM_TOO_BIG
//
// MessageText:
//
// The new cache item exceeds the maximum per-item size defined for the cache.
//
#define SCARD_W_CACHE_ITEM_TOO_BIG ((DWORD)0x80100072L)
#endif // SCARD_S_SUCCESS

View File

@ -0,0 +1,886 @@
/*++
Copyright (c) 2005 Microsoft Corporation
Module Name:
USBProtocolDefs.h
Abstract:
USB protocol definitions
Author:
--*/
#ifndef _USBPROTOCOLDEFS_H_
#define _USBPROTOCOLDEFS_H_
#include <PSHPACK1.h>
// Initial address for an unconnected wired device.
#define USB_UnConnected_Device_Address 0
#define USB_UNCONNECTED_ADDRESS(address) ( USB_UnConnected_Device_Address == (address))
#define USB_CONNECTED_ADDRESS(address) ( USB_UnConnected_Device_Address != (address) )
//PID definition taken from
//USB Spec 2.0 chapter 8.3.1
// Token
#define PID_OUT 1
#define PID_IN 9
#define PID_SOF 5
#define PID_SETUP 13
// Data
#define PID_DATA0 3
#define PID_DATA1 11
#define PID_DATA2 7
#define PID_MDATA 15
// Handshake
#define USB_ACK 2
#define USB_NAK 10
#define USB_STALL 14
#define USB_NYET 6
// Special
#define USB_PRE 12
#define USB_ERR 12
#define USB_SPLIT 8
#define USB_PING 4
#define USB_TIMEOUT 0
/////////////////////////////////////////////////////////////////////
// Spec release
#define USB_SPEC 0x0200
#define HID_SPEC 0x0101
/////////////////////////////////////////////////////////////////////
// USB Device specification
#define USB_20_SPEC 0x0200
#define USB_11_SPEC 0x0110
#define USB_10_SPEC 0x0100
/////////////////////////////////////////////////////////////////////
// Default values:
// Device Descriptor
#define HID_MAX_PACKET_SIZE0 0x08
#define MICROSOFT_VENDOR_ID 0x045E
#define HID_DEVICE_RELEASE 0x0100
// Endpoint Descriptor
#define HID_MAX_PACKET_SIZE 0x0008
#define HID_POLLING_INTERVAL 0x0A
#define MAX_POLLING_INTERVAL 0xFF
// Product IDs
#define USB_DEFAULT_KEYBOARD_PRODUCT_ID 0x000B // Microsoft USB Natural Keyboard from keyboard.inf
#define USB_DEFAULT_MOUSE_PRODUCT_ID 0x0040 // Microsoft USB Wheel Mouse Optical from msmouse.inf
/////////////////////////////////////////////////////////////////////
// Descriptor type Table 9.5 usb2.0 spec
#define DEVICE_DESCRIPTOR 0x01
#define CONFIGURATION_DESCRIPTOR 0x02
#define STRING_DESCRIPTOR 0x03
#define INTERFACE_DESCRIPTOR 0x04
#define ENDPOINT_DESCRIPTOR 0x05
#define QUALIFIER_DESCRIPTOR 0x06
#define OTHER_SPEED_DESCRIPTOR 0x07
#define INTERFACE_POWER_DESCRIPTOR 0x08
// Class-specific descriptor types
#define HID_DESCRIPTOR 0x21
#define REPORT_DESCRIPTOR 0x22
#define PHYSICAL_DESCRIPTOR 0x23
#define HUB_DESCRIPTOR 0x29
// USBDESCRIPTORTYPE defines the high byte of wValue for a
// GET_DESCRIPTOR request
typedef union _USBDESCRIPTORTYPE
{
BYTE Byte;
#if !defined(MIDL_PASS)
struct Bits
{
BYTE Descriptor:5; // bits 0-4 descriptor type as qualified by the Type field
BYTE Type:2; // bits 5-6
BYTE Reserved:1; // bit 7
} Bits;
#endif
} USBDESCRIPTORTYPE;
// These are the possible values for USBDESCRIPTORTYPE.Bits.Type
#define USB_DESCRIPTOR_TYPE_STD 0
#define USB_DESCRIPTOR_TYPE_CLASS 1
#define USB_DESCRIPTOR_TYPE_VENDOR 2
#define USB_DESCRIPTOR_TYPE_RESERVED 3
/////////////////////////////////////////////////////////////////////
// REQUEST TYPES
// Taken from USB 2.0 spec. Table 9-2
// Data transfer direction. D7
#define DIR_HOST_TO_DEVICE 0
#define DIR_DEVICE_TO_HOST 1
// Type. D6..5
#define TYPE_STANDARD 0
#define TYPE_CLASS 1
#define TYPE_VENDOR 2
#define TYPE_RESERVED 3
// Recipient D4..0
#define RCPT_DEVICE 0
#define RCPT_INTERFACE 1
#define RCPT_ENDPOINT 2
#define RCPT_OTHER 3
#define RCPT_PORT 4
#define RCPT_RPIPE 5
#if !defined(MIDL_PASS)
#define USB_MAKE_REQUEST_TYPE(direction, type, recipient) (BYTE)( ((BYTE)direction << 7) | ((BYTE)type << 5) | ((BYTE)recipient & 0x07) )
#endif
/////////////////////////////////////////////////////////////////////
// STANDARD REQUESTS
#define GET_STATUS 0
#define CLEAR_FEATURE 1
#define SET_FEATURE 3
#define SET_ADDRESS 5
#define GET_DESCRIPTOR 6
#define SET_DESCRIPTOR 7
#define GET_CONFIGURATION 8
#define SET_CONFIGURATION 9
#define GET_INTERFACE 10
#define SET_INTERFACE 11
#define SYNCH_FRAME 12
/////////////////////////////////////////////////////////////////////
// BULK-ONLY MASS STORAGE CLASS REQUESTS
#define USB_BULK_ONLY_MASS_STG_RESET 0xFF
#define USB_BULK_ONLY_MASS_STG_GET_MAX_LUN 0xFE
/////////////////////////////////////////////////////////////////////
// HID CLASS REQUESTS
#define GET_REPORT 0x01
#define GET_IDLE 0x02
#define GET_PROTOCOL 0x03
#define SET_REPORT 0x09
#define SET_IDLE 0x0A
#define SET_PROTOCOL 0x0B
///////////////////////////////////////////////////////////////////
// HWA Device class requests
#define ADD_MMC_IE 20
#define REMOVE_MMC_IE 21
#define SET_NUM_DNTS 22
#define SET_CLUSTER_ID 23
#define SET_DEVICE_INFO 24
#define GET_TIME 25
#define SET_STREAM_INDEX 26
#define SET_WUSB_MAS 27
#define WUSB_CH_STOP 28
//RC Class requests
#define EXEC_RC_CMD 40
////////////////////////////////////////////////////////////////////
// WUSB Channel Time Type
#define TIME_ADJ 0x01
#define TIME_BPST 0x02
#define TIME_WUSB 0x03
/////////////////////////////////////////////////////////////////////
// HID REPORT TYPES
#define HID_REPORT_TYPE_INPUT 0x01
#define HID_REPORT_TYPE_OUTPUT 0x02
#define HID_REPORT_TYPE_FEATURE 0x03
/////////////////////////////////////////////////////////////////////
// HID protocol types for GET/SET_PROTOCOL requests
#define HID_PROTOCOL_TYPE_BOOT 0x00
#define HID_PROTOCOL_TYPE_REPORT 0x01
///////////////////////////////////////////////////////////////////
// HUB protocol definitions
#define HUB_DEVICE_PROTOCOL_1X 0
#define HUB_DEVICE_PROTOCOL_SINGLE_TT 1
#define HUB_DEVICE_PROTOCOL_MULTI_TT 2
#define HUB_INTERFACE_PROTOCOL_1X 0
#define HUB_INTERFACE_PROTOCOL_SINGLE_TT 0
#define HUB_INTERFACE_PROTOCOL_MULTI_TT_IN_SINGLE_TT_MODE 1
#define HUB_INTERFACE_PROTOCOL_MULTI_TT_IN_MULTI_TT_MODE 2
///////////////////////////////////////////////////////////////////
//HUB Class Request code
#define CLEAR_TT_BUFFER 8
#define RESET_TT 9
#define GET_TT_STATE 10
#define STOP_TT 11
///////////////////////////////////////////////////////////////////
//HUB And PORT Feature selector
#define C_HUB_LOCAL_POWER 0
#define C_HUB_OVER_CURRENT 1
#define PORT_CONNECTION 0
#define PORT_ENABLE 1
#define PORT_SUSPEND 2
#define PORT_OVER_CURRENT 3
#define PORT_RESET 4
#define PORT_POWER 8
#define PORT_LOW_SPEED 9
#define C_PORT_CONNECTION 16
#define C_PORT_ENABLE 17
#define C_PORT_SUSPEND 18
#define C_PORT_OVER_CURRENT 19
#define C_PORT_RESET 20
#define PORT_TEST 21
#define PORT_INDICATOR 22
/////////////////////////////////////////////////////////////////////
// SETUP Constants
#define USBSETUPSIZE 8
#define USBINREQUEST 128
/////////////////////////////////////////////////////////////////////
// BM_REQUESTES
#define BM_GET_DEVICE 128
#define BM_GET_INTERFACE 129
#define BM_GET_ENDPOINT 130
#define BM_SET_DEVICE 0
#define BM_SET_INTERFACE 1
#define BM_SET_ENDPOINT 2
#define HALT_ENDPOINT 0
#define REMOTE_WAKEUP 1
#define TEST_MODE 2
/////////////////////////////////////////////////////////////////////
// Descriptor requests
#define DEVICE_DESCRIPTION_TYPE 0x100
#define QUALIFIER_DESCRIPTION_TYPE 0x600
#define OTHER_SPEED_DESCRIPTION_TYPE 0x700
#define CONFIG_DESCRIPTION_TYPE 0x200
#define STRING_DESCRIPTION_TYPE 0x300
#define MSOS_DESCRIPTION_TYPE 0x3EE
/////////////////////////////////////////////////////////////////////
// Configuration Descriptor values
// bmAttribute bits in Configuration Descriptor
// - USB 2.0 9.6.3 (bmAttributes in Table 9-10): Bit 7 is reserved, and always set to one
#define CONFIG_BUS_POWERED 0x80
#define CONFIG_SELF_POWERED 0x40
// Not to be confused with Device Remote Wakeup feature selector!
#define CONFIG_REMOTE_WAKEUP 0x20
//HWA definitions
#define USB_WA_MULTIFUNCTION 0x02
#define USB_WA_PROTOCOL 0x01
#define USB_RADIO_CONTROL 0x2
typedef union _USBCONFIGATTRIBS
{
BYTE Byte;
#if !defined(MIDL_PASS)
struct Bits
{
BYTE bReserved0_4:5; // bits 0-4
BYTE bRemoteWakeup:1; // bit 5
BYTE bSelfPowered:1; // bit 6
BYTE bReserved7:1; // bit 7
} Bits;
#endif
} USBCONFIGATTRIBS;
/////////////////////////////////////////////////////////////////////
// Interface Descriptor values
// bInterfaceClass values
#define USB_HID_CLASS_CODE 0x03
#define USB_MASS_STORAGE_CLASS_CODE 0x08
#define USB_HUB_CLASS_CODE 0x09
#define USB_MISCELLANEOUS 0xEF
#define USB_WIRELESS_WA 0xE0
// bInterfaceSubClass value
#define BOOT_INTERFACE_SUBCLASS 0x01
#define COMMON_CLASS 0x02
#define USB_RF_CONTROL 0x01
// bInterfaceProtocol values for HID
#define PROTOCOL_NONE 0x00
#define PROTOCOL_KEYBOARD 0x01
#define PROTOCOL_MOUSE 0x02
/////////////////////////////////////////////////////////////////////
// Endpoint Descriptor values
// Macros for generating bEndpointAddress value
// - USB HID 1.11 Appendix E.5
#define EP_OUT 0
#define EP_IN 1
// Bit 0..3 The end point number
// Bit 4..6 Reserved, reset to zero
// Bit 7 Direction, ignored for control endpoints
#define MAKE_ENDPOINT_ADDRESS(num, dir) ( ((BYTE)(dir) << 7) | ((BYTE)(num) & 0x0F) )
// bmAttributes values
// ENDPOINT TYPES
#define ENDPOINT_TYPE 0x03
#define CONTROL_ENDPOINT 0
#define ISOCHRONOUS_ENDPOINT 1
#define BULK_ENDPOINT 2
#define INTERRUPT_ENDPOINT 3
//Define standard USB structures which are used to transfer data from the
//host to the endpoints
typedef union _USBREQUESTTYPE
{
BYTE Byte;
#if !defined(MIDL_PASS)
struct Bits
{
BYTE Recipient:5; // bits 0-4
BYTE Type:2; // bits 5-6
BYTE Direction:1; // bit 7
} Bits;
#endif
} USBREQUESTTYPE;
#if !defined(MIDL_PASS)
C_ASSERT((sizeof(USBREQUESTTYPE) == sizeof(BYTE)));
#endif
typedef struct _USBSETUPREQUEST
{
USBREQUESTTYPE bmRequestType; // Setup request type
BYTE bRequest; // Setup Request
SHORT sSetupValue; // Value for the setup request
SHORT sSetupIndex; // Index for the setup request
SHORT sSetupLength; // Data Length for the device
} USBSETUPREQUEST;
#if !defined(MIDL_PASS)
typedef struct _USBDEVICEDESC
{
BYTE bLength;
BYTE bDescriptorType;
USHORT usUSB;
BYTE bDeviceClass;
BYTE bDeviceSubClass;
BYTE bProtocol;
BYTE bMaxPacket0;
USHORT usVendor;
USHORT usProduct;
USHORT usDeviceNumber;
BYTE bManufacturer;
BYTE bProductDesc;
BYTE bSerialNumber;
BYTE bNumConfigs;
} USBDEVICEDESC;
typedef struct _USBCONFIGDESC
{
BYTE bLength;
BYTE bDescriptorType;
USHORT usTotalLength;
BYTE bNumInterfaces;
BYTE bConfigValue;
BYTE bConfig;
BYTE bAttributes;
BYTE bMaxPower;
} USBCONFIGDESC;
typedef struct _USBINTERFACEDESC
{
BYTE bLength;
BYTE bDescriptorType;
BYTE bInterfaceNumber;
BYTE bAlternateSetting;
BYTE bNumEndpoints;
BYTE bClass;
BYTE bSubClass;
BYTE bProtocol;
BYTE bDescription;
} USBINTERFACEDESC;
#define ENDPOINT_DIRECTION_OUT 0
#define ENDPOINT_DIRECTION_IN 1
typedef union _USBENDPOINTADDRESS
{
BYTE Byte;
struct Bits
{
BYTE Number:4; // bits 0-3
BYTE Reserved:3; // bits 4-6
BYTE Direction:1; // bit 7
} Bits;
} USBENDPOINTADDRESS;
C_ASSERT((sizeof(USBENDPOINTADDRESS) == sizeof(BYTE)));
#define USB_TRANSFER_TYPE_CONTROL 0
#define USB_TRANSFER_TYPE_ISOCH 1
#define USB_TRANSFER_TYPE_BULK 2
#define USB_TRANSFER_TYPE_INTERRUPT 3
#define USB_SYNC_TYPE_NONE 0
#define USB_SYNC_TYPE_ASYNC 1
#define USB_SYNC_TYPE_ADAPTIVE 2
#define USB_SYNC_TYPE_SYNC 3
#define USB_USAGE_TYPE_DATA 0
#define USB_USAGE_TYPE_FEEDBACK 1
#define USB_USAGE_TYPE_IMPLICIT 2
#define USB_USAGE_TYPE_RESERVED 3
typedef union _USBENDPOINTATTRIBS
{
BYTE Byte;
struct Bits
{
BYTE TransferType:2; // bits 0-1
BYTE SyncType:2; // bits 3-4
BYTE UsageType:2; // bits 5-6
BYTE Reserved:2; // bits 7-8
} Bits;
} USBENDPOINTATTRIBS;
C_ASSERT((sizeof(USBENDPOINTATTRIBS) == sizeof(BYTE)));
typedef union _USBMAXPACKET
{
WORD Word;
struct Bits
{
WORD Size:11; // bits 0-10
WORD AdditionalXactions:2; // bits 11-12
WORD Reserved:3; // bits 13-15
} Bits;
} USBMAXPACKET;
C_ASSERT((sizeof(USBMAXPACKET) == sizeof(WORD)));
typedef struct _USBENDPOINTDESC
{
BYTE bLength;
BYTE bDescriptorType;
USBENDPOINTADDRESS Address;
USBENDPOINTATTRIBS Attributes;
USBMAXPACKET MaxPacket;
BYTE bInterval;
} USBENDPOINTDESC;
typedef struct _USBQUALIFIERDESC
{
BYTE bLength;
BYTE bDescriptorType;
USHORT usUSB;
BYTE bDeviceClass;
BYTE bDeviceSubClass;
BYTE bProtocol;
BYTE bMaxPacket;
BYTE bNumConfigs;
BYTE bReserved;
} USBQUALIFIERDESC;
typedef struct _USBSTRINGDESC
{
BYTE bLength;
BYTE bDescriptorType;
WCHAR wchData[1];
} USBSTRINGDESC;
typedef struct _USBSTRINGLANGIDS
{
BYTE bLength;
BYTE bDescriptorType;
WORD wLANGIDs[1];
} USBSTRINGLANGIDS;
typedef struct _USBHIDSTANDARDDESC
{
BYTE bLength;
BYTE bDescriptorType;
USHORT bcdHID;
BYTE bCountryCode;
BYTE bNumDescriptors;
} USBHIDSTANDARDDESC;
typedef struct _USBHIDOPTIONALDESC
{
BYTE bClassDescriptorType;
USHORT usDescriptorLength;
} USBHIDOPTIONALDESC;
typedef struct _USBPHYSICALDESCSET0
{
BYTE bNumber;
BYTE bLength;
} USBPHYSICALDESCSET0;
typedef union _USBPHYSICALDESCSET
{
BYTE bPhysicalInfo;
struct Bits
{
BYTE bPreference : 5;
BYTE bBias : 3;
} Bits;
} USBPHYSICALDESCSET;
typedef struct _USBPHYSICALDESCITEM
{
BYTE bDesignator;
union Flags
{
BYTE bFlags;
struct Bits
{
BYTE bEffort : 5;
BYTE bQualifier : 3;
} Bits;
} Flags;
} USBPHYSICALDESCITEM;
typedef union _USBHUBCHARACTERISTICS
{
WORD wHubCharacteristics;
struct Bits
{
BYTE bLogicalPowerSwitchingMode : 2;
BYTE fCompoundDevice : 1;
BYTE bOverCurrentMode : 2;
BYTE bTTThinkTime : 2;
BYTE fPortIndicatorSupport : 1;
BYTE bReserved : 8;
} Bits;
} USBHUBCHARACTERISTICS;
#if !defined(MIDL_PASS)
C_ASSERT((sizeof(USBHUBCHARACTERISTICS) == sizeof(WORD)));
#endif
typedef struct _USBHUBDESC
{
BYTE bLength;
BYTE bDescriptorType;
BYTE bNumberOfPorts;
USBHUBCHARACTERISTICS Characteristics;
BYTE bPwrOn2PwrGood;
BYTE bHubContrCurrent;
BYTE bDeviceRemovable[32]; // Defined as its maximum possible size for 255 ports
BYTE bPortPwrCtrlMask[32]; // Defined as its maximum possible size for 255 ports
} USBHUBDESC;
#if !defined(MIDL_PASS)
C_ASSERT((sizeof(USBHUBDESC) == 71));
#endif
typedef union _USBHUBPORTSTATUS
{
WORD wPortStatus;
struct Bits
{
BYTE fCurrentConnectionStatus : 1;
BYTE fEnabled : 1;
BYTE fSuspend : 1;
BYTE fOverCurrent : 1;
BYTE fReset : 1;
BYTE bReserved1 : 3;
BYTE fPortPower : 1;
BYTE fLowSpeedDevice : 1;
BYTE fHighSpeedDevice : 1;
BYTE fTestMode : 1;
BYTE fPortIndicatorControl : 1;
BYTE bReserved2 : 3;
} Bits;
} USBHUBPORTSTATUS;
#if !defined(MIDL_PASS)
C_ASSERT((sizeof(USBHUBPORTSTATUS) == sizeof(WORD)));
#endif
typedef union _USBHUBPORTSTATUSCHANGE
{
WORD wPortStatusChange;
struct Bits
{
BYTE fConnectionStatusChange : 1;
BYTE fEnabledChange : 1;
BYTE fSuspendChange : 1;
BYTE fOverCurrentChange : 1;
BYTE fResetChange : 1;
BYTE bReserved1 : 3;
BYTE bReserved2 : 8;
} Bits;
} USBHUBPORTSTATUSCHANGE;
#if !defined(MIDL_PASS)
C_ASSERT((sizeof(USBHUBPORTSTATUSCHANGE) == sizeof(WORD)));
#endif
typedef struct _USBHUBPORTDATA
{
USBHUBPORTSTATUS PortStatus;
USBHUBPORTSTATUSCHANGE PortStatusChange;
} USBHUBPORTDATA;
// USB Language Identifiers
//
// These are taken directly from http://www.usb.org/developers/docs/USB_LANGIDs.pdf
// USB_MAKE_LANGID(lang, sublang)
//
// Use this macro to create a language ID. For example, for US English
// use:
//
// USB_MAKE_LANGID(USB_LANG_ENGLISH, USB_SUBLANG_ENGLISH_US)
#define USB_MAKE_LANGID(lang, sublang) ((((USHORT)(sublang)) << 10) | (USHORT)(lang))
#define USB_LANG_RESERVED 0x00
#define USB_LANG_ARABIC 0x01
#define USB_LANG_BULGARIAN 0x02
#define USB_LANG_CATALAN 0x03
#define USB_LANG_CHINESE 0x04
#define USB_LANG_CZECH 0x05
#define USB_LANG_DANISH 0x06
#define USB_LANG_GERMAN 0x07
#define USB_LANG_GREEK 0x08
#define USB_LANG_ENGLISH 0x09
#define USB_LANG_SPANISH 0x0a
#define USB_LANG_FINNISH 0x0b
#define USB_LANG_FRENCH 0x0c
#define USB_LANG_HEBREW 0x0d
#define USB_LANG_HUNGARIAN 0x0e
#define USB_LANG_ICELANDIC 0x0f
#define USB_LANG_ITALIAN 0x10
#define USB_LANG_JAPANESE 0x11
#define USB_LANG_KOREAN 0x12
#define USB_LANG_DUTCH 0x13
#define USB_LANG_NORWEGIAN 0x14
#define USB_LANG_POLISH 0x15
#define USB_LANG_PORTUGUESE 0x16
#define USB_LANG_ROMANIAN 0x18
#define USB_LANG_RUSSIAN 0x19
#define USB_LANG_CROATIAN 0x1a
#define USB_LANG_SERBIAN 0x1a
#define USB_LANG_SLOVAK 0x1b
#define USB_LANG_ALBANIAN 0x1c
#define USB_LANG_SWEDISH 0x1d
#define USB_LANG_THAI 0x1e
#define USB_LANG_TURKISH 0x1f
#define USB_LANG_URDU 0x20
#define USB_LANG_INDONESIAN 0x21
#define USB_LANG_UKRANIAN 0x22
#define USB_LANG_BELARUSIAN 0x23
#define USB_LANG_SLOVENIAN 0x24
#define USB_LANG_ESTONIAN 0x25
#define USB_LANG_LATVIAN 0x26
#define USB_LANG_LITHUANIAN 0x27
#define USB_LANG_FARSI 0x29
#define USB_LANG_VIETNAMESE 0x2a
#define USB_LANG_ARMENIAN 0x2b
#define USB_LANG_AZERI 0x2c
#define USB_LANG_BASQUE 0x2d
#define USB_LANG_MACEDONIAN 0x2f // This is actually Macedonian (FYROM)
#define USB_LANG_AFRIKAANS 0x36
#define USB_LANG_GEORGIAN 0x37
#define USB_LANG_FAEROESE 0x38
#define USB_LANG_HINDI 0x39
#define USB_LANG_MALAY 0x3e
#define USB_LANG_KAZAK 0x3f
#define USB_LANG_SWAHILI 0x41
#define USB_LANG_UZBEK 0x43
#define USB_LANG_TATAR 0x44
#define USB_LANG_BENGALI 0x45
#define USB_LANG_PUNJABI 0x46
#define USB_LANG_GUJARATI 0x47
#define USB_LANG_ORIYA 0x48
#define USB_LANG_TAMIL 0x49
#define USB_LANG_TELUGU 0x4a
#define USB_LANG_KANNADA 0x4b
#define USB_LANG_MALAYALAM 0x4c
#define USB_LANG_ASSAMESE 0x4d
#define USB_LANG_MARATHI 0x4e
#define USB_LANG_SANSKRIT 0x4f
#define USB_LANG_KONKANI 0x57
#define USB_LANG_MANIPURI 0x58
#define USB_LANG_SINDHI 0x59
#define USB_LANG_KASHMIRI 0x60
#define USB_LANG_NEPALI 0x61
#define USB_LANG_HID 0xff
#define USB_SUBLANG_ARABIC_SAUDI_ARABIA 0x01
#define USB_SUBLANG_ARABIC_SAUDI_ARABIA 0x01
#define USB_SUBLANG_ARABIC_IRAQ 0x02
#define USB_SUBLANG_ARABIC_EGYPT 0x03
#define USB_SUBLANG_ARABIC_LIBYA 0x04
#define USB_SUBLANG_ARABIC_ALGERIA 0x05
#define USB_SUBLANG_ARABIC_MOROCCO 0x06
#define USB_SUBLANG_ARABIC_TUNISIA 0x07
#define USB_SUBLANG_ARABIC_OMAN 0x08
#define USB_SUBLANG_ARABIC_YEMEN 0x09
#define USB_SUBLANG_ARABIC_SYRIA 0x10
#define USB_SUBLANG_ARABIC_JORDAN 0x11
#define USB_SUBLANG_ARABIC_LEBANON 0x12
#define USB_SUBLANG_ARABIC_KUWAIT 0x13
#define USB_SUBLANG_ARABIC_UAE 0x14
#define USB_SUBLANG_ARABIC_BAHRAIN 0x15
#define USB_SUBLANG_ARABIC_QATAR 0x16
#define USB_SUBLANG_AZERI_CYRILLIC 0x01
#define USB_SUBLANG_AZERI_LATIN 0x02
#define USB_SUBLANG_CHINESE_TRADITIONAL 0x01
#define USB_SUBLANG_CHINESE_SIMPLIFIED 0x02
#define USB_SUBLANG_CHINESE_HONGKONG 0x03
#define USB_SUBLANG_CHINESE_SINGAPORE 0x04
#define USB_SUBLANG_CHINESE_MACAU 0x05
#define USB_SUBLANG_DUTCH 0x01
#define USB_SUBLANG_DUTCH_BELGIAN 0x02
#define USB_SUBLANG_ENGLISH_US 0x01
#define USB_SUBLANG_ENGLISH_UK 0x02
#define USB_SUBLANG_ENGLISH_AUS 0x03
#define USB_SUBLANG_ENGLISH_CAN 0x04
#define USB_SUBLANG_ENGLISH_NZ 0x05
#define USB_SUBLANG_ENGLISH_EIRE 0x06
#define USB_SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
#define USB_SUBLANG_ENGLISH_JAMAICA 0x08
#define USB_SUBLANG_ENGLISH_CARIBBEAN 0x09
#define USB_SUBLANG_ENGLISH_BELIZE 0x0a
#define USB_SUBLANG_ENGLISH_TRINIDAD 0x0b
#define USB_SUBLANG_ENGLISH_PHILIPPINES 0x0c
#define USB_SUBLANG_ENGLISH_ZIMBABWE 0x0d
#define USB_SUBLANG_FRENCH 0x01
#define USB_SUBLANG_FRENCH_BELGIAN 0x02
#define USB_SUBLANG_FRENCH_CANADIAN 0x03
#define USB_SUBLANG_FRENCH_SWISS 0x04
#define USB_SUBLANG_FRENCH_LUXEMBOURG 0x05
#define USB_SUBLANG_FRENCH_MONACO 0x06
#define USB_SUBLANG_GERMAN 0x01
#define USB_SUBLANG_GERMAN_SWISS 0x02
#define USB_SUBLANG_GERMAN_AUSTRIAN 0x03
#define USB_SUBLANG_GERMAN_LUXEMBOURG 0x04
#define USB_SUBLANG_GERMAN_LIECHTENSTEIN 0x05
#define USB_SUBLANG_ITALIAN 0x01
#define USB_SUBLANG_ITALIAN_SWISS 0x02
#define USB_SUBLANG_KASHMIRI_INDIA 0x02
#define USB_SUBLANG_KOREAN 0x01
#define USB_SUBLANG_LITHUANIAN 0x01
#define USB_SUBLANG_MALAY_MALAYSIA 0x01
#define USB_SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
#define USB_SUBLANG_NEPALI_INDIA 0x02
#define USB_SUBLANG_NORWEGIAN_BOKMAL 0x01
#define USB_SUBLANG_NORWEGIAN_NYNORSK 0x02
#define USB_SUBLANG_PORTUGUESE 0x01
#define USB_SUBLANG_PORTUGUESE_BRAZILIAN 0x02
#define USB_SUBLANG_SERBIAN_LATIN 0x02
#define USB_SUBLANG_SERBIAN_CYRILLIC 0x03
#define USB_SUBLANG_SPANISH 0x01
#define USB_SUBLANG_SPANISH_MEXICAN 0x02
#define USB_SUBLANG_SPANISH_MODERN 0x03
#define USB_SUBLANG_SPANISH_GUATEMALA 0x04
#define USB_SUBLANG_SPANISH_COSTA_RICA 0x05
#define USB_SUBLANG_SPANISH_PANAMA 0x06
#define USB_SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
#define USB_SUBLANG_SPANISH_VENEZUELA 0x08
#define USB_SUBLANG_SPANISH_COLOMBIA 0x09
#define USB_SUBLANG_SPANISH_PERU 0x0a
#define USB_SUBLANG_SPANISH_ARGENTINA 0x0b
#define USB_SUBLANG_SPANISH_ECUADOR 0x0c
#define USB_SUBLANG_SPANISH_CHILE 0x0d
#define USB_SUBLANG_SPANISH_URUGUAY 0x0e
#define USB_SUBLANG_SPANISH_PARAGUAY 0x0f
#define USB_SUBLANG_SPANISH_BOLIVIA 0x10
#define USB_SUBLANG_SPANISH_EL_SALVADOR 0x11
#define USB_SUBLANG_SPANISH_HONDURAS 0x12
#define USB_SUBLANG_SPANISH_NICARAGUA 0x13
#define USB_SUBLANG_SPANISH_PUERTO_RICO 0x14
#define USB_SUBLANG_SWEDISH 0x01
#define USB_SUBLANG_SWEDISH_FINLAND 0x02
#define USB_SUBLANG_URDU_PAKISTAN 0x01
#define USB_SUBLANG_URDU_INDIA 0x02
#define USB_SUBLANG_UZBEK_LATIN 0x01
#define USB_SUBLANG_UZBEK_CYRILLIC 0x02
#define USB_SUBLANG_HID_USAGE_DATA_DESCRIPTOR 0x01
#define USB_SUBLANG_HID_VENDOR_DEFINED_1 0x3c
#define USB_SUBLANG_HID_VENDOR_DEFINED_2 0x3d
#define USB_SUBLANG_HID_VENDOR_DEFINED_3 0x3e
#define USB_SUBLANG_HID_VENDOR_DEFINED_4 0x3f
#endif // !defined(MIDL_PASS)
#include <POPPACK.h>
#endif //_USBPROTOCOLDEFS_H_

View File

@ -0,0 +1,802 @@
/*+-------------------------------------------------------------------
Microsoft Windows
Copyright (C) Microsoft Corporation, 1993-1998.
File: accctrl.h
Contents: common includes for new style Win32 Access Control
APIs
--------------------------------------------------------------------*/
#ifndef __ACCESS_CONTROL__
#define __ACCESS_CONTROL__
#ifndef __midl
#include <wtypes.h>
#endif
#if (_MSC_VER >= 800)
#if (_MSC_VER >= 1200)
#pragma warning(push)
#endif
#pragma warning(disable:4001) /* nonstandard extension : single line comment */
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define AccFree LocalFree
//
// Definition:
// This enumerated type defines the objects supported by the get/set API within
// this document. See section 3.1, Object Types for a detailed definition of the
// supported object types, and their name formats.
//
typedef enum _SE_OBJECT_TYPE
{
SE_UNKNOWN_OBJECT_TYPE = 0,
SE_FILE_OBJECT,
SE_SERVICE,
SE_PRINTER,
SE_REGISTRY_KEY,
SE_LMSHARE,
SE_KERNEL_OBJECT,
SE_WINDOW_OBJECT,
SE_DS_OBJECT,
SE_DS_OBJECT_ALL,
SE_PROVIDER_DEFINED_OBJECT,
SE_WMIGUID_OBJECT,
SE_REGISTRY_WOW64_32KEY,
} SE_OBJECT_TYPE;
//
// Definition: TRUSTEE_TYPE
// This enumerated type specifies the type of trustee account for the trustee
// returned by the API described in this document.
// TRUSTEE_IS_UNKNOWN - The trustee is an unknown, but not necessarily invalid
// type. This field is not validated on input to the APIs
// that take Trustees.
// TRUSTEE_IS_USER The trustee account is a user account.
// TRUSTEE_IS_GROUP The trustee account is a group account.
//
typedef enum _TRUSTEE_TYPE
{
TRUSTEE_IS_UNKNOWN,
TRUSTEE_IS_USER,
TRUSTEE_IS_GROUP,
TRUSTEE_IS_DOMAIN,
TRUSTEE_IS_ALIAS,
TRUSTEE_IS_WELL_KNOWN_GROUP,
TRUSTEE_IS_DELETED,
TRUSTEE_IS_INVALID,
TRUSTEE_IS_COMPUTER
} TRUSTEE_TYPE;
//
// Definition: TRUSTEE_FORM
// This enumerated type specifies the form the trustee identifier is in for a
// particular trustee.
// TRUSTEE_IS_SID The trustee is identified with a SID rather than with a name.
// TRUSTEE_IS_NAME The trustee is identified with a name.
//
typedef enum _TRUSTEE_FORM
{
TRUSTEE_IS_SID,
TRUSTEE_IS_NAME,
TRUSTEE_BAD_FORM,
TRUSTEE_IS_OBJECTS_AND_SID,
TRUSTEE_IS_OBJECTS_AND_NAME
} TRUSTEE_FORM;
//
// Definition: MULTIPLE_TRUSTEE_OPERATION
// If the trustee is a multiple trustee, this enumerated type specifies the type.
// TRUSTEE_IS_IMPERSONATE The trustee is an impersonate trustee and the multiple
// trustee field in the trustee points to another trustee
// that is a trustee for the server that will be doing the
// impersonation.
//
typedef enum _MULTIPLE_TRUSTEE_OPERATION
{
NO_MULTIPLE_TRUSTEE,
TRUSTEE_IS_IMPERSONATE,
} MULTIPLE_TRUSTEE_OPERATION;
typedef struct _OBJECTS_AND_SID
{
DWORD ObjectsPresent;
GUID ObjectTypeGuid;
GUID InheritedObjectTypeGuid;
SID * pSid;
} OBJECTS_AND_SID, *POBJECTS_AND_SID;
typedef struct _OBJECTS_AND_NAME_A
{
DWORD ObjectsPresent;
SE_OBJECT_TYPE ObjectType;
LPSTR ObjectTypeName;
LPSTR InheritedObjectTypeName;
LPSTR ptstrName;
} OBJECTS_AND_NAME_A, *POBJECTS_AND_NAME_A;
typedef struct _OBJECTS_AND_NAME_W
{
DWORD ObjectsPresent;
SE_OBJECT_TYPE ObjectType;
LPWSTR ObjectTypeName;
LPWSTR InheritedObjectTypeName;
LPWSTR ptstrName;
} OBJECTS_AND_NAME_W, *POBJECTS_AND_NAME_W;
#ifdef UNICODE
typedef OBJECTS_AND_NAME_W OBJECTS_AND_NAME_;
typedef POBJECTS_AND_NAME_W POBJECTS_AND_NAME_;
#else
typedef OBJECTS_AND_NAME_A OBJECTS_AND_NAME_;
typedef POBJECTS_AND_NAME_A POBJECTS_AND_NAME_;
#endif // UNICODE
//
// Definition: TRUSTEE
// This structure is used to pass account information into and out of the system
// using the API defined in this document.
// PMultipleTrustee - if NON-NULL, points to another trustee structure, as
// defined by the multiple trustee operation field.
// MultipleTrusteeOperation - Defines the multiple trustee operation/type.
// TrusteeForm - defines if the trustee is defined by name or SID.
// TrusteeType - defines if the trustee type is unknown, a user or a group.
// PwcsName - points to the trustee name or the trustee SID.
//
typedef struct _TRUSTEE_A
{
struct _TRUSTEE_A *pMultipleTrustee;
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation;
TRUSTEE_FORM TrusteeForm;
TRUSTEE_TYPE TrusteeType;
#ifdef __midl
[switch_is(TrusteeForm)]
union
{
[case(TRUSTEE_IS_NAME)]
LPSTR ptstrName;
[case(TRUSTEE_IS_SID)]
SID *pSid;
[case(TRUSTEE_IS_OBJECTS_AND_SID)]
OBJECTS_AND_SID *pObjectsAndSid;
[case(TRUSTEE_IS_OBJECTS_AND_NAME)]
OBJECTS_AND_NAME_A *pObjectsAndName;
};
#else
LPSTR ptstrName;
#endif
} TRUSTEE_A, *PTRUSTEE_A, TRUSTEEA, *PTRUSTEEA;
typedef struct _TRUSTEE_W
{
struct _TRUSTEE_W *pMultipleTrustee;
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation;
TRUSTEE_FORM TrusteeForm;
TRUSTEE_TYPE TrusteeType;
#ifdef __midl
[switch_is(TrusteeForm)]
union
{
[case(TRUSTEE_IS_NAME)]
LPWSTR ptstrName;
[case(TRUSTEE_IS_SID)]
SID *pSid;
[case(TRUSTEE_IS_OBJECTS_AND_SID)]
OBJECTS_AND_SID *pObjectsAndSid;
[case(TRUSTEE_IS_OBJECTS_AND_NAME)]
OBJECTS_AND_NAME_W *pObjectsAndName;
};
#else
LPWSTR ptstrName;
#endif
} TRUSTEE_W, *PTRUSTEE_W, TRUSTEEW, *PTRUSTEEW;
#ifdef UNICODE
typedef TRUSTEE_W TRUSTEE_;
typedef PTRUSTEE_W PTRUSTEE_;
typedef TRUSTEEW TRUSTEE;
typedef PTRUSTEEW PTRUSTEE;
#else
typedef TRUSTEE_A TRUSTEE_;
typedef PTRUSTEE_A PTRUSTEE_;
typedef TRUSTEEA TRUSTEE;
typedef PTRUSTEEA PTRUSTEE;
#endif // UNICODE
//
// Definition: ACCESS_MODE
// This enumerated type specifies how permissions are (requested)/to be applied
// for the trustee by the access control entry. On input this field can by any
// of the values, although it is not meaningful to mix access control and audit
// control entries. On output this field will be either SET_ACCESS, DENY_ACCESS,
// SET_AUDIT_SUCCESS, SET_AUDIT_FAILURE.
// The following descriptions define how this type effects an explicit access
// request to apply access permissions to an object.
// GRANT_ACCESS - The trustee will have at least the requested permissions upon
// successful completion of the command. (If the trustee has
// additional permissions they will not be removed).
// SET_ACCESS - The trustee will have exactly the requested permissions upon
// successful completion of the command.
// DENY_ACCESS - The trustee will be denied the specified permissions.
// REVOKE_ACCESS - Any explicit access rights the trustee has will be revoked.
// SET_AUDIT_SUCCESS - The trustee will be audited for successful opens of the
// object using the requested permissions.
// SET_AUDIT_FAILURE - The trustee will be audited for failed opens of the object
// using the requested permissions.
//
typedef enum _ACCESS_MODE
{
NOT_USED_ACCESS = 0,
GRANT_ACCESS,
SET_ACCESS,
DENY_ACCESS,
REVOKE_ACCESS,
SET_AUDIT_SUCCESS,
SET_AUDIT_FAILURE
} ACCESS_MODE;
//
// Definition: Inheritance flags
// These bit masks are provided to allow simple application of inheritance in
// explicit access requests on containers.
// NO_INHERITANCE The specific access permissions will only be applied to
// the container, and will not be inherited by objects created
// within the container.
// SUB_CONTAINERS_ONLY_INHERIT The specific access permissions will be inherited
// and applied to sub containers created within the
// container, and will be applied to the container
// itself.
// SUB_OBJECTS_ONLY_INHERIT The specific access permissions will only be inherited
// by objects created within the specific container.
// The access permissions will not be applied to the
// container itself.
// SUB_CONTAINERS_AND_OBJECTS_INHERIT The specific access permissions will be
// inherited by containers created within the
// specific container, will be applied to
// objects created within the container, but
// will not be applied to the container itself.
//
#define NO_INHERITANCE 0x0
#define SUB_OBJECTS_ONLY_INHERIT 0x1
#define SUB_CONTAINERS_ONLY_INHERIT 0x2
#define SUB_CONTAINERS_AND_OBJECTS_INHERIT 0x3
#define INHERIT_NO_PROPAGATE 0x4
#define INHERIT_ONLY 0x8
//
// Informational bit that is returned
//
#define INHERITED_ACCESS_ENTRY 0x10
//
// Informational bit that tells where a node was inherited from. Valid only
// for NT 5 APIs
//
#define INHERITED_PARENT 0x10000000
#define INHERITED_GRANDPARENT 0x20000000
//
// Definition: EXPLICIT_ACCESS
// This structure is used to pass access control entry information into and out
// of the system using the API defined in this document.
// grfAccessPermissions - This contains the access permissions to assign for the
// trustee. It is in the form of an NT access mask.
// grfAccessMode - This field defines how the permissions are to be applied for
// the trustee.
// grfInheritance - For containers, this field defines how the access control
// entry is/(is requested) to be inherited on
// objects/sub-containers created within the container.
// Trustee - This field contains the definition of the trustee account the
// explicit access applies to.
//
typedef struct _EXPLICIT_ACCESS_A
{
DWORD grfAccessPermissions;
ACCESS_MODE grfAccessMode;
DWORD grfInheritance;
TRUSTEE_A Trustee;
} EXPLICIT_ACCESS_A, *PEXPLICIT_ACCESS_A, EXPLICIT_ACCESSA, *PEXPLICIT_ACCESSA;
typedef struct _EXPLICIT_ACCESS_W
{
DWORD grfAccessPermissions;
ACCESS_MODE grfAccessMode;
DWORD grfInheritance;
TRUSTEE_W Trustee;
} EXPLICIT_ACCESS_W, *PEXPLICIT_ACCESS_W, EXPLICIT_ACCESSW, *PEXPLICIT_ACCESSW;
#ifdef UNICODE
typedef EXPLICIT_ACCESS_W EXPLICIT_ACCESS_;
typedef PEXPLICIT_ACCESS_W PEXPLICIT_ACCESS_;
typedef EXPLICIT_ACCESSW EXPLICIT_ACCESS;
typedef PEXPLICIT_ACCESSW PEXPLICIT_ACCESS;
#else
typedef EXPLICIT_ACCESS_A EXPLICIT_ACCESS_;
typedef PEXPLICIT_ACCESS_A PEXPLICIT_ACCESS_;
typedef EXPLICIT_ACCESSA EXPLICIT_ACCESS;
typedef PEXPLICIT_ACCESSA PEXPLICIT_ACCESS;
#endif // UNICODE
//----------------------------------------------------------------------------
//
// NT5 APIs
//
//----------------------------------------------------------------------------
//
// Default provider
//
#define ACCCTRL_DEFAULT_PROVIDERA "Windows NT Access Provider"
#define ACCCTRL_DEFAULT_PROVIDERW L"Windows NT Access Provider"
#ifdef UNICODE
#define ACCCTRL_DEFAULT_PROVIDER ACCCTRL_DEFAULT_PROVIDERW
#else
#define ACCCTRL_DEFAULT_PROVIDER ACCCTRL_DEFAULT_PROVIDERA
#endif
//
/// Access rights
//
typedef ULONG ACCESS_RIGHTS, *PACCESS_RIGHTS;
//
// Inheritance flags
//
typedef ULONG INHERIT_FLAGS, *PINHERIT_FLAGS;
//
// Access / Audit structures
//
typedef struct _ACTRL_ACCESS_ENTRYA
{
TRUSTEE_A Trustee;
ULONG fAccessFlags;
ACCESS_RIGHTS Access;
ACCESS_RIGHTS ProvSpecificAccess;
INHERIT_FLAGS Inheritance;
LPSTR lpInheritProperty;
} ACTRL_ACCESS_ENTRYA, *PACTRL_ACCESS_ENTRYA;
//
// Access / Audit structures
//
typedef struct _ACTRL_ACCESS_ENTRYW
{
TRUSTEE_W Trustee;
ULONG fAccessFlags;
ACCESS_RIGHTS Access;
ACCESS_RIGHTS ProvSpecificAccess;
INHERIT_FLAGS Inheritance;
LPWSTR lpInheritProperty;
} ACTRL_ACCESS_ENTRYW, *PACTRL_ACCESS_ENTRYW;
#ifdef UNICODE
typedef ACTRL_ACCESS_ENTRYW ACTRL_ACCESS_ENTRY;
typedef PACTRL_ACCESS_ENTRYW PACTRL_ACCESS_ENTRY;
#else
typedef ACTRL_ACCESS_ENTRYA ACTRL_ACCESS_ENTRY;
typedef PACTRL_ACCESS_ENTRYA PACTRL_ACCESS_ENTRY;
#endif // UNICODE
typedef struct _ACTRL_ACCESS_ENTRY_LISTA
{
ULONG cEntries;
#ifdef __midl
[size_is(cEntries)]
#endif
ACTRL_ACCESS_ENTRYA *pAccessList;
} ACTRL_ACCESS_ENTRY_LISTA, *PACTRL_ACCESS_ENTRY_LISTA;
typedef struct _ACTRL_ACCESS_ENTRY_LISTW
{
ULONG cEntries;
#ifdef __midl
[size_is(cEntries)]
#endif
ACTRL_ACCESS_ENTRYW *pAccessList;
} ACTRL_ACCESS_ENTRY_LISTW, *PACTRL_ACCESS_ENTRY_LISTW;
#ifdef UNICODE
typedef ACTRL_ACCESS_ENTRY_LISTW ACTRL_ACCESS_ENTRY_LIST;
typedef PACTRL_ACCESS_ENTRY_LISTW PACTRL_ACCESS_ENTRY_LIST;
#else
typedef ACTRL_ACCESS_ENTRY_LISTA ACTRL_ACCESS_ENTRY_LIST;
typedef PACTRL_ACCESS_ENTRY_LISTA PACTRL_ACCESS_ENTRY_LIST;
#endif // UNICODE
typedef struct _ACTRL_PROPERTY_ENTRYA
{
LPSTR lpProperty;
PACTRL_ACCESS_ENTRY_LISTA pAccessEntryList;
ULONG fListFlags;
} ACTRL_PROPERTY_ENTRYA, *PACTRL_PROPERTY_ENTRYA;
typedef struct _ACTRL_PROPERTY_ENTRYW
{
LPWSTR lpProperty;
PACTRL_ACCESS_ENTRY_LISTW pAccessEntryList;
ULONG fListFlags;
} ACTRL_PROPERTY_ENTRYW, *PACTRL_PROPERTY_ENTRYW;
#ifdef UNICODE
typedef ACTRL_PROPERTY_ENTRYW ACTRL_PROPERTY_ENTRY;
typedef PACTRL_PROPERTY_ENTRYW PACTRL_PROPERTY_ENTRY;
#else
typedef ACTRL_PROPERTY_ENTRYA ACTRL_PROPERTY_ENTRY;
typedef PACTRL_PROPERTY_ENTRYA PACTRL_PROPERTY_ENTRY;
#endif // UNICODE
typedef struct _ACTRL_ALISTA
{
ULONG cEntries;
#ifdef __midl
[size_is(cEntries)]
#endif
PACTRL_PROPERTY_ENTRYA pPropertyAccessList;
} ACTRL_ACCESSA, *PACTRL_ACCESSA, ACTRL_AUDITA, *PACTRL_AUDITA;
typedef struct _ACTRL_ALISTW
{
ULONG cEntries;
#ifdef __midl
[size_is(cEntries)]
#endif
PACTRL_PROPERTY_ENTRYW pPropertyAccessList;
} ACTRL_ACCESSW, *PACTRL_ACCESSW, ACTRL_AUDITW, *PACTRL_AUDITW;
#ifdef UNICODE
typedef ACTRL_ACCESSW ACTRL_ACCESS;
typedef PACTRL_ACCESSW PACTRL_ACCESS;
typedef ACTRL_AUDITW ACTRL_AUDIT;
typedef PACTRL_AUDITW PACTRL_AUDIT;
#else
typedef ACTRL_ACCESSA ACTRL_ACCESS;
typedef PACTRL_ACCESSA PACTRL_ACCESS;
typedef ACTRL_AUDITA ACTRL_AUDIT;
typedef PACTRL_AUDITA PACTRL_AUDIT;
#endif // UNICODE
//
// TRUSTEE_ACCESS flags
//
#define TRUSTEE_ACCESS_ALLOWED 0x00000001L
#define TRUSTEE_ACCESS_READ 0x00000002L
#define TRUSTEE_ACCESS_WRITE 0x00000004L
#define TRUSTEE_ACCESS_EXPLICIT 0x00000001L
#define TRUSTEE_ACCESS_READ_WRITE (TRUSTEE_ACCESS_READ | \
TRUSTEE_ACCESS_WRITE)
#define TRUSTEE_ACCESS_ALL 0xFFFFFFFFL
typedef struct _TRUSTEE_ACCESSA
{
LPSTR lpProperty;
ACCESS_RIGHTS Access;
ULONG fAccessFlags;
ULONG fReturnedAccess;
} TRUSTEE_ACCESSA, *PTRUSTEE_ACCESSA;
typedef struct _TRUSTEE_ACCESSW
{
LPWSTR lpProperty;
ACCESS_RIGHTS Access;
ULONG fAccessFlags;
ULONG fReturnedAccess;
} TRUSTEE_ACCESSW, *PTRUSTEE_ACCESSW;
#ifdef UNICODE
typedef TRUSTEE_ACCESSW TRUSTEE_ACCESS;
typedef PTRUSTEE_ACCESSW PTRUSTEE_ACCESS;
#else
typedef TRUSTEE_ACCESSA TRUSTEE_ACCESS;
typedef PTRUSTEE_ACCESSA PTRUSTEE_ACCESS;
#endif // UNICODE
//
// Generic permission values
//
#define ACTRL_RESERVED 0x00000000
#define ACTRL_PERM_1 0x00000001
#define ACTRL_PERM_2 0x00000002
#define ACTRL_PERM_3 0x00000004
#define ACTRL_PERM_4 0x00000008
#define ACTRL_PERM_5 0x00000010
#define ACTRL_PERM_6 0x00000020
#define ACTRL_PERM_7 0x00000040
#define ACTRL_PERM_8 0x00000080
#define ACTRL_PERM_9 0x00000100
#define ACTRL_PERM_10 0x00000200
#define ACTRL_PERM_11 0x00000400
#define ACTRL_PERM_12 0x00000800
#define ACTRL_PERM_13 0x00001000
#define ACTRL_PERM_14 0x00002000
#define ACTRL_PERM_15 0x00004000
#define ACTRL_PERM_16 0x00008000
#define ACTRL_PERM_17 0x00010000
#define ACTRL_PERM_18 0x00020000
#define ACTRL_PERM_19 0x00040000
#define ACTRL_PERM_20 0x00080000
//
// Access permissions
//
#define ACTRL_ACCESS_ALLOWED 0x00000001
#define ACTRL_ACCESS_DENIED 0x00000002
#define ACTRL_AUDIT_SUCCESS 0x00000004
#define ACTRL_AUDIT_FAILURE 0x00000008
//
// Property list flags
//
#define ACTRL_ACCESS_PROTECTED 0x00000001
//
// Standard and object rights
//
#define ACTRL_SYSTEM_ACCESS 0x04000000
#define ACTRL_DELETE 0x08000000
#define ACTRL_READ_CONTROL 0x10000000
#define ACTRL_CHANGE_ACCESS 0x20000000
#define ACTRL_CHANGE_OWNER 0x40000000
#define ACTRL_SYNCHRONIZE 0x80000000
#define ACTRL_STD_RIGHTS_ALL 0xf8000000
#define ACTRL_STD_RIGHT_REQUIRED ( ACTRL_STD_RIGHTS_ALL & ~ACTRL_SYNCHRONIZE )
#ifndef _DS_CONTROL_BITS_DEFINED_
#define _DS_CONTROL_BITS_DEFINED_
#define ACTRL_DS_OPEN ACTRL_RESERVED
#define ACTRL_DS_CREATE_CHILD ACTRL_PERM_1
#define ACTRL_DS_DELETE_CHILD ACTRL_PERM_2
#define ACTRL_DS_LIST ACTRL_PERM_3
#define ACTRL_DS_SELF ACTRL_PERM_4
#define ACTRL_DS_READ_PROP ACTRL_PERM_5
#define ACTRL_DS_WRITE_PROP ACTRL_PERM_6
#define ACTRL_DS_DELETE_TREE ACTRL_PERM_7
#define ACTRL_DS_LIST_OBJECT ACTRL_PERM_8
#define ACTRL_DS_CONTROL_ACCESS ACTRL_PERM_9
#endif
#define ACTRL_FILE_READ ACTRL_PERM_1
#define ACTRL_FILE_WRITE ACTRL_PERM_2
#define ACTRL_FILE_APPEND ACTRL_PERM_3
#define ACTRL_FILE_READ_PROP ACTRL_PERM_4
#define ACTRL_FILE_WRITE_PROP ACTRL_PERM_5
#define ACTRL_FILE_EXECUTE ACTRL_PERM_6
#define ACTRL_FILE_READ_ATTRIB ACTRL_PERM_8
#define ACTRL_FILE_WRITE_ATTRIB ACTRL_PERM_9
#define ACTRL_FILE_CREATE_PIPE ACTRL_PERM_10
#define ACTRL_DIR_LIST ACTRL_PERM_1
#define ACTRL_DIR_CREATE_OBJECT ACTRL_PERM_2
#define ACTRL_DIR_CREATE_CHILD ACTRL_PERM_3
#define ACTRL_DIR_DELETE_CHILD ACTRL_PERM_7
#define ACTRL_DIR_TRAVERSE ACTRL_PERM_6
#define ACTRL_KERNEL_TERMINATE ACTRL_PERM_1
#define ACTRL_KERNEL_THREAD ACTRL_PERM_2
#define ACTRL_KERNEL_VM ACTRL_PERM_3
#define ACTRL_KERNEL_VM_READ ACTRL_PERM_4
#define ACTRL_KERNEL_VM_WRITE ACTRL_PERM_5
#define ACTRL_KERNEL_DUP_HANDLE ACTRL_PERM_6
#define ACTRL_KERNEL_PROCESS ACTRL_PERM_7
#define ACTRL_KERNEL_SET_INFO ACTRL_PERM_8
#define ACTRL_KERNEL_GET_INFO ACTRL_PERM_9
#define ACTRL_KERNEL_CONTROL ACTRL_PERM_10
#define ACTRL_KERNEL_ALERT ACTRL_PERM_11
#define ACTRL_KERNEL_GET_CONTEXT ACTRL_PERM_12
#define ACTRL_KERNEL_SET_CONTEXT ACTRL_PERM_13
#define ACTRL_KERNEL_TOKEN ACTRL_PERM_14
#define ACTRL_KERNEL_IMPERSONATE ACTRL_PERM_15
#define ACTRL_KERNEL_DIMPERSONATE ACTRL_PERM_16
#define ACTRL_PRINT_SADMIN ACTRL_PERM_1
#define ACTRL_PRINT_SLIST ACTRL_PERM_2
#define ACTRL_PRINT_PADMIN ACTRL_PERM_3
#define ACTRL_PRINT_PUSE ACTRL_PERM_4
#define ACTRL_PRINT_JADMIN ACTRL_PERM_5
#define ACTRL_SVC_GET_INFO ACTRL_PERM_1
#define ACTRL_SVC_SET_INFO ACTRL_PERM_2
#define ACTRL_SVC_STATUS ACTRL_PERM_3
#define ACTRL_SVC_LIST ACTRL_PERM_4
#define ACTRL_SVC_START ACTRL_PERM_5
#define ACTRL_SVC_STOP ACTRL_PERM_6
#define ACTRL_SVC_PAUSE ACTRL_PERM_7
#define ACTRL_SVC_INTERROGATE ACTRL_PERM_8
#define ACTRL_SVC_UCONTROL ACTRL_PERM_9
#define ACTRL_REG_QUERY ACTRL_PERM_1
#define ACTRL_REG_SET ACTRL_PERM_2
#define ACTRL_REG_CREATE_CHILD ACTRL_PERM_3
#define ACTRL_REG_LIST ACTRL_PERM_4
#define ACTRL_REG_NOTIFY ACTRL_PERM_5
#define ACTRL_REG_LINK ACTRL_PERM_6
#define ACTRL_WIN_CLIPBRD ACTRL_PERM_1
#define ACTRL_WIN_GLOBAL_ATOMS ACTRL_PERM_2
#define ACTRL_WIN_CREATE ACTRL_PERM_3
#define ACTRL_WIN_LIST_DESK ACTRL_PERM_4
#define ACTRL_WIN_LIST ACTRL_PERM_5
#define ACTRL_WIN_READ_ATTRIBS ACTRL_PERM_6
#define ACTRL_WIN_WRITE_ATTRIBS ACTRL_PERM_7
#define ACTRL_WIN_SCREEN ACTRL_PERM_8
#define ACTRL_WIN_EXIT ACTRL_PERM_9
#pragma warning (push)
#pragma warning (disable: 4201)
typedef struct _ACTRL_OVERLAPPED
{
union {
PVOID Provider;
ULONG Reserved1;
} DUMMYUNIONNAME;
ULONG Reserved2;
HANDLE hEvent;
} ACTRL_OVERLAPPED, *PACTRL_OVERLAPPED;
#pragma warning(pop)
typedef struct _ACTRL_ACCESS_INFOA
{
ULONG fAccessPermission;
LPSTR lpAccessPermissionName;
} ACTRL_ACCESS_INFOA, *PACTRL_ACCESS_INFOA;
typedef struct _ACTRL_ACCESS_INFOW
{
ULONG fAccessPermission;
LPWSTR lpAccessPermissionName;
} ACTRL_ACCESS_INFOW, *PACTRL_ACCESS_INFOW;
#ifdef UNICODE
typedef ACTRL_ACCESS_INFOW ACTRL_ACCESS_INFO;
typedef PACTRL_ACCESS_INFOW PACTRL_ACCESS_INFO;
#else
typedef ACTRL_ACCESS_INFOA ACTRL_ACCESS_INFO;
typedef PACTRL_ACCESS_INFOA PACTRL_ACCESS_INFO;
#endif // UNICODE
typedef struct _ACTRL_CONTROL_INFOA
{
LPSTR lpControlId;
LPSTR lpControlName;
} ACTRL_CONTROL_INFOA, *PACTRL_CONTROL_INFOA;
typedef struct _ACTRL_CONTROL_INFOW
{
LPWSTR lpControlId;
LPWSTR lpControlName;
} ACTRL_CONTROL_INFOW, *PACTRL_CONTROL_INFOW;
#ifdef UNICODE
typedef ACTRL_CONTROL_INFOW ACTRL_CONTROL_INFO;
typedef PACTRL_CONTROL_INFOW PACTRL_CONTROL_INFO;
#else
typedef ACTRL_CONTROL_INFOA ACTRL_CONTROL_INFO;
typedef PACTRL_CONTROL_INFOA PACTRL_CONTROL_INFO;
#endif // UNICODE
#define ACTRL_ACCESS_NO_OPTIONS 0x00000000
#define ACTRL_ACCESS_SUPPORTS_OBJECT_ENTRIES 0x00000001
#if (NTDDI_VERSION >= NTDDI_VISTA)
#define TREE_SEC_INFO_SET 0x00000001
#define TREE_SEC_INFO_RESET 0x00000002
#define TREE_SEC_INFO_RESET_KEEP_EXPLICIT 0x00000003
#endif // (NTDDI_VERSION >= NTDDI_VISTA)
typedef enum _PROGRESS_INVOKE_SETTING {
ProgressInvokeNever = 1, // Never invoke the progress function
ProgressInvokeEveryObject, // Invoke for each object
ProgressInvokeOnError, // Invoke only for each error case
ProgressCancelOperation, // Stop propagation and return
ProgressRetryOperation, // Retry operation on subtree
#if (NTDDI_VERSION >= NTDDI_VISTA)
ProgressInvokePrePostError, // Invoke Pre, Post, Error
#endif // (NTDDI_VERSION >= NTDDI_VISTA)
} PROG_INVOKE_SETTING, *PPROG_INVOKE_SETTING;
//
// Progress Function:
// Caller of tree operation implements this Progress function, then
// passes its function pointer to tree operation.
// Tree operation invokes Progress function to provide progress and error
// information to the caller during the potentially long execution
// of the tree operation. Tree operation provides the name of the object
// last processed and the error status of the operation on that object.
// Tree operation also passes the current InvokeSetting value.
// Caller may change the InvokeSetting value, for example, from "Always"
// to "Only On Error."
//
/*
typedef VOID (*FN_PROGRESS) (
IN LPWSTR pObjectName, // name of object just processed
IN DWORD Status, // status of operation on object
IN OUT PPROG_INVOKE_SETTING pInvokeSetting, // Never, always,
IN PVOID Args, // Caller specific data
IN BOOL SecuritySet // Whether security was set
);
*/
//
// New Object Type function pointers. TBD.
// To support additional object resource managers generically, the
// resource manager must provide it's own functions for operations
// like:
// GetAncestorAcl(IN ObjName, IN GenerationGap, IN DaclOrSacl?, ...)
// GetAncestorName(...)
// FreeNameStructure(...)
//
typedef struct _FN_OBJECT_MGR_FUNCTIONS
{
ULONG Placeholder;
} FN_OBJECT_MGR_FUNCTS, *PFN_OBJECT_MGR_FUNCTS;
//
// Name of ancestor and number of generations between
// ancestor and inheriting object.
//
// GenerationGap:
// Name of ancestor from which ACE was inherited.
// NULL for explicit ACE.
//
// AncestorName:
// Number of levels (or generations) between the object and the ancestor.
// Parent, gap=1.
// Grandparent, gap=2.
// Set to 0 for explicit ACE on object.
//
typedef struct _INHERITED_FROMA
{
LONG GenerationGap;
LPSTR AncestorName;
} INHERITED_FROMA, *PINHERITED_FROMA;
typedef struct _INHERITED_FROMW
{
LONG GenerationGap;
LPWSTR AncestorName;
} INHERITED_FROMW, *PINHERITED_FROMW;
#ifdef UNICODE
typedef INHERITED_FROMW INHERITED_FROM;
typedef PINHERITED_FROMW PINHERITED_FROM;
#else
typedef INHERITED_FROMA INHERITED_FROM;
typedef PINHERITED_FROMA PINHERITED_FROM;
#endif // UNICODE
#ifdef __cplusplus
}
#endif
#if (_MSC_VER >= 800)
#if (_MSC_VER >= 1200)
#pragma warning(pop)
#else
#pragma warning(default:4001)
#endif
#endif
#endif /* __ACCESS_CONTROL__ */

View File

@ -0,0 +1,253 @@
/*++
Copyright (c) 1997 Microsoft Corporation
Module Name:
acpiioct.h
Abstract:
This module handles all of the INTERNAL_DEVICE_CONTROLS requested to
the ACPI driver
Author:
Environment:
NT Kernel Model Driver only
--*/
#ifndef _ACPIIOCT_H_
#define _ACPIIOCT_H_
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#pragma warning(push)
#endif
#pragma warning(disable:4201) // named type definition in parentheses
//
// IRP_MJ_INTERNAL_DEVICE_CONTROL CODES
//
#define IOCTL_ACPI_ASYNC_EVAL_METHOD CTL_CODE(FILE_DEVICE_ACPI, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_ACPI_EVAL_METHOD CTL_CODE(FILE_DEVICE_ACPI, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_ACPI_ACQUIRE_GLOBAL_LOCK CTL_CODE(FILE_DEVICE_ACPI, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_ACPI_RELEASE_GLOBAL_LOCK CTL_CODE(FILE_DEVICE_ACPI, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#if (NTDDI_VERSION >= NTDDI_VISTA)
#define IOCTL_ACPI_EVAL_METHOD_EX CTL_CODE(FILE_DEVICE_ACPI, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_ACPI_ASYNC_EVAL_METHOD_EX CTL_CODE(FILE_DEVICE_ACPI, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_ACPI_ENUM_CHILDREN CTL_CODE(FILE_DEVICE_ACPI, 8, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#endif
//
// Data structures used for IOCTL_ACPI_ASYNC_EVAL_METHOD and
// IOCTL_ACPI_EVAL_METHOD
//
//
// Possible Input buffer
//
typedef struct _ACPI_EVAL_INPUT_BUFFER {
ULONG Signature;
union {
UCHAR MethodName[4];
ULONG MethodNameAsUlong;
} DUMMYUNIONNAME;
} ACPI_EVAL_INPUT_BUFFER, *PACPI_EVAL_INPUT_BUFFER;
typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER {
ULONG Signature;
union {
UCHAR MethodName[4];
ULONG MethodNameAsUlong;
} DUMMYUNIONNAME;
ULONG IntegerArgument;
} ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER;
typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING {
ULONG Signature;
union {
UCHAR MethodName[4];
ULONG MethodNameAsUlong;
} DUMMYUNIONNAME;
ULONG StringLength;
UCHAR String[ANYSIZE_ARRAY];
} ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING;
typedef struct _ACPI_METHOD_ARGUMENT {
USHORT Type;
USHORT DataLength;
union {
ULONG Argument;
UCHAR Data[ANYSIZE_ARRAY];
} DUMMYUNIONNAME;
} ACPI_METHOD_ARGUMENT;
typedef ACPI_METHOD_ARGUMENT UNALIGNED *PACPI_METHOD_ARGUMENT;
#define ACPI_METHOD_ARGUMENT_LENGTH( DataLength ) \
(FIELD_OFFSET(ACPI_METHOD_ARGUMENT, Data) + max(sizeof(ULONG), DataLength))
#define ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT( Argument ) \
(ACPI_METHOD_ARGUMENT_LENGTH(((PACPI_METHOD_ARGUMENT)Argument)->DataLength))
#define ACPI_METHOD_NEXT_ARGUMENT( Argument ) \
(PACPI_METHOD_ARGUMENT) ( (PUCHAR) Argument + \
ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT( Argument ) )
#define ACPI_METHOD_SET_ARGUMENT_INTEGER( MethodArgument, IntData ) \
{ MethodArgument->Type = ACPI_METHOD_ARGUMENT_INTEGER; \
MethodArgument->DataLength = sizeof(ULONG); \
MethodArgument->Argument = IntData; }
#define ACPI_METHOD_SET_ARGUMENT_STRING( Argument, StrData ) \
{ Argument->Type = ACPI_METHOD_ARGUMENT_STRING; \
Argument->DataLength = strlen((PUCHAR)StrData) + sizeof(UCHAR); \
RtlCopyMemory(&Argument->Data[0],(PUCHAR)StrData,Argument->DataLength); }
#define ACPI_METHOD_SET_ARGUMENT_BUFFER( Argument, BuffData, BuffLength ) \
{ Argument->Type = ACPI_METHOD_ARGUMENT_BUFFER; \
Argument->DataLength = BuffLength; \
RtlCopyMemory(&Argument->Data[0],(PUCHAR)BuffData,Argument->DataLength); }
typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX {
ULONG Signature;
union {
UCHAR MethodName[4];
ULONG MethodNameAsUlong;
} DUMMYUNIONNAME;
ULONG Size;
ULONG ArgumentCount;
ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY];
} ACPI_EVAL_INPUT_BUFFER_COMPLEX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX;
typedef struct _ACPI_EVAL_OUTPUT_BUFFER {
ULONG Signature;
ULONG Length;
ULONG Count;
ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY];
} ACPI_EVAL_OUTPUT_BUFFER;
typedef ACPI_EVAL_OUTPUT_BUFFER UNALIGNED *PACPI_EVAL_OUTPUT_BUFFER;
#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE 'BieA'
#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE 'IieA'
#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE 'SieA'
#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE 'CieA'
#define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE 'BoeA'
#if (NTDDI_VERSION >= NTDDI_VISTA)
#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE_EX 'AieA'
#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_EX 'DieA'
#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_EX 'EieA'
#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_EX 'FieA'
#define ACPI_ENUM_CHILDREN_OUTPUT_BUFFER_SIGNATURE 'GieA'
#define ACPI_ENUM_CHILDREN_INPUT_BUFFER_SIGNATURE 'HieA'
#endif
#define ACPI_METHOD_ARGUMENT_INTEGER 0x0
#define ACPI_METHOD_ARGUMENT_STRING 0x1
#define ACPI_METHOD_ARGUMENT_BUFFER 0x2
#define ACPI_METHOD_ARGUMENT_PACKAGE 0x3
#define ACPI_METHOD_ARGUMENT_PACKAGE_EX 0x4
//
// Data structures used for IOCTL_ACPI_ACQUIRE_GLOBAL_LOCK
// IOCTL_ACPI_RELEASE_GLOBAL_LOCK
//
typedef struct _ACPI_MANIPULATE_GLOBAL_LOCK_BUFFER {
ULONG Signature;
PVOID LockObject;
} ACPI_MANIPULATE_GLOBAL_LOCK_BUFFER, *PACPI_MANIPULATE_GLOBAL_LOCK_BUFFER;
#define ACPI_ACQUIRE_GLOBAL_LOCK_SIGNATURE 'LgaA'
#define ACPI_RELEASE_GLOBAL_LOCK_SIGNATURE 'LgrA'
//
// Data structure used for IOCTL_ACPI_ASYNC_EVAL_METHOD_EX,
// IOCTL_ACPI_EVAL_METHOD_EX and
// IOCTL_ACPI_ENUM_CHILDREN
//
typedef struct _ACPI_EVAL_INPUT_BUFFER_EX {
ULONG Signature;
CHAR MethodName[256]; //NULL terminated name string
} ACPI_EVAL_INPUT_BUFFER_EX, *PACPI_EVAL_INPUT_BUFFER_EX;
typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX {
ULONG Signature;
CHAR MethodName[256];//NULL terminated name string
ULONG64 IntegerArgument;
} ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX;
typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX {
ULONG Signature;
CHAR MethodName[256];//NULL terminated name string
ULONG StringLength;
UCHAR String[ANYSIZE_ARRAY];
} ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX;
typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_EX {
ULONG Signature;
CHAR MethodName[256];//NULL terminated name string
ULONG Size;
ULONG ArgumentCount;
ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY];
} ACPI_EVAL_INPUT_BUFFER_COMPLEX_EX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX_EX;
typedef struct _ACPI_ENUM_CHILDREN_INPUT_BUFFER {
ULONG Signature;
ULONG Flags;
ULONG NameLength;
CHAR Name[ANYSIZE_ARRAY];
} ACPI_ENUM_CHILDREN_INPUT_BUFFER, *PACPI_ENUM_CHILDREN_INPUT_BUFFER;
typedef struct _ACPI_ENUM_CHILD {
ULONG Flags;
ULONG NameLength; // length including null terminator
CHAR Name[ANYSIZE_ARRAY];
} ACPI_ENUM_CHILD;
typedef ACPI_ENUM_CHILD UNALIGNED *PACPI_ENUM_CHILD;
typedef struct _ACPI_ENUM_CHILDREN_OUTPUT_BUFFER {
ULONG Signature;
ULONG NumberOfChildren;
ACPI_ENUM_CHILD Children[ANYSIZE_ARRAY];
} ACPI_ENUM_CHILDREN_OUTPUT_BUFFER;
typedef ACPI_ENUM_CHILDREN_OUTPUT_BUFFER UNALIGNED *PACPI_ENUM_CHILDREN_OUTPUT_BUFFER;
#define ACPI_ENUM_CHILD_LENGTH_FROM_CHILD( Child ) \
( (2* sizeof (ULONG)) + Child->NameLength )
#define ACPI_ENUM_CHILD_NEXT( Child ) \
(PACPI_ENUM_CHILD) ( (PUCHAR) Child + \
ACPI_ENUM_CHILD_LENGTH_FROM_CHILD( Child ) )
//
// valid flags for ACPI_ENUM_CHILDREN_INPUT_BUFFER.Flags
//
#define ENUM_CHILDREN_IMMEDIATE_ONLY 0x1
#define ENUM_CHILDREN_MULTILEVEL 0x2
#define ENUM_CHILDREN_NAME_IS_FILTER 0x4
//
// valid flags for ACPI_ENUM_CHILD
//
#define ACPI_OBJECT_HAS_CHILDREN 0x1
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#pragma warning(pop)
#endif
#endif

View File

@ -0,0 +1,68 @@
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//--------------------------------------------------------------------------;
//
//
// We want to use this list for generating strings for debugging too
// so we redefine OUR_GUID_ENTRY depending on what we want to do
//
// It is imperative that all entries in this file are declared using
// OUR_GUID_ENTRY as that macro might have been defined in advance of
// including this file. See wxdebug.cpp in sdk\classes\base.
//
#ifndef OUR_GUID_ENTRY
#define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8);
#endif
// -------------------------------------------------------------------------
// TVTuner GUIDS
// -------------------------------------------------------------------------
// {266EEE40-6C63-11cf-8A03-00AA006ECB65}
OUR_GUID_ENTRY(CLSID_CTVTunerFilter,
0x266eee40, 0x6c63, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
// {266EEE41-6C63-11cf-8A03-00AA006ECB65}
OUR_GUID_ENTRY(CLSID_CTVTunerFilterPropertyPage,
0x266eee41, 0x6c63, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
// {266EEE44-6C63-11cf-8A03-00AA006ECB65}
OUR_GUID_ENTRY(IID_AnalogVideoStandard,
0x266eee44, 0x6c63, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
// {266EEE46-6C63-11cf-8A03-00AA006ECB65}
OUR_GUID_ENTRY(IID_TunerInputType,
0x266eee46, 0x6c63, 0x11cf, 0x8a, 0x3, 0x0, 0xaa, 0x0, 0x6e, 0xcb, 0x65);
// -------------------------------------------------------------------------
// Crossbar (XBar) GUIDS
// -------------------------------------------------------------------------
// {71F96460-78F3-11d0-A18C-00A0C9118956}
OUR_GUID_ENTRY(CLSID_CrossbarFilter,
0x71f96460, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
// {71F96461-78F3-11d0-A18C-00A0C9118956}
OUR_GUID_ENTRY(CLSID_CrossbarFilterPropertyPage,
0x71f96461, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
// {71F96462-78F3-11d0-A18C-00A0C9118956}
OUR_GUID_ENTRY(CLSID_TVAudioFilter,
0x71f96462, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);
// {71F96463-78F3-11d0-A18C-00A0C9118956}
OUR_GUID_ENTRY(CLSID_TVAudioFilterPropertyPage,
0x71f96463, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x0, 0xa0, 0xc9, 0x11, 0x89, 0x56);

View File

@ -0,0 +1,316 @@
/*
* AnchorSyncDeviceService.h
*
* Contains definitions for the Anchor Sync Device Service
*
* Copyright (c) Microsoft Corporation, All Rights Reserved.
*
*/
#ifndef _ANCHORSYNCSERVICE_H_
#define _ANCHORSYNCSERVICE_H_
#include <DeviceServices.h>
#include <SyncDeviceService.h>
/*****************************************************************************/
/* Anchor Sync Service Info */
/*****************************************************************************/
DEFINE_DEVSVCGUID(SERVICE_AnchorSync,
0x056d8b9e, 0xad7a, 0x44fc, 0x94, 0x6f, 0x1d, 0x63, 0xa2, 0x5c, 0xda, 0x9a);
#define NAME_AnchorSyncSvc L"AnchorSync"
#define TYPE_AnchorSyncSvc DEVSVCTYPE_ABSTRACT
/*****************************************************************************/
/* Anchor Sync Service Properties */
/*****************************************************************************/
DEFINE_DEVSVCGUID(NAMESPACE_AnchorSyncSvc,
0xe65b8fb7, 0x8fc7, 0x4278, 0xb9, 0xa3, 0xba, 0x14, 0xc2, 0xdb, 0x40, 0xfa);
/* PKEY_AnchorSyncSvc_VersionProps
*
* Provides information about change units and version properties. The
* format for the dataset is
*
* UINT32 Number of change units
* UINT128 Namespace GUID for first change unit property key
* UINT32 Namespace ID for the first change unit property key
* UINT32 Number of properties associated with this change unit
* UINT128 Namespace GUID for first property key in change unit
* UINT32 Namespace ID for first property key in change unit
* ... Repeat for number of property keys
* ... Repeat for number of change units
*
* NOTE: If all change units use the same property key specify a namespace
* GUID of GUID_NULL (all 0's) and a namespace ID of 0.
*
* Type: AUInt8
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorSyncSvc_VersionProps,
0xe65b8fb7, 0x8fc7, 0x4278, 0xb9, 0xa3, 0xba, 0x14, 0xc2, 0xdb, 0x40, 0xfa,
2);
#define NAME_AnchorSyncSvc_VersionProps L"AnchorVersionProps"
/* PKEY_AnchorSyncSvc_ReplicaID
*
* Contains the GUID representing this replica in the sync community.
*
* Type: UInt128
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorSyncSvc_ReplicaID,
0xe65b8fb7, 0x8fc7, 0x4278, 0xb9, 0xa3, 0xba, 0x14, 0xc2, 0xdb, 0x40, 0xfa,
3);
#define NAME_AnchorSyncSvc_ReplicaID L"AnchorReplicaID"
/* PKEY_AnchorSyncSvc_KnowledgeObjectID
*
* Object ID to be used for the knowledge object
*
* Type: UInt32
* Form: Object ID
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorSyncSvc_KnowledgeObjectID,
0xe65b8fb7, 0x8fc7, 0x4278, 0xb9, 0xa3, 0xba, 0x14, 0xc2, 0xdb, 0x40, 0xfa,
4);
#define NAME_AnchorSyncSvc_KnowledgeObjectID L"AnchorKnowledgeObjectID"
/* PKEY_AnchorSyncSvc_LastSyncProxyID
*
* Contains a GUID indicating the last sync proxy to perform a sync operation
*
* Type: UInt128
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorSyncSvc_LastSyncProxyID,
0xe65b8fb7, 0x8fc7, 0x4278, 0xb9, 0xa3, 0xba, 0x14, 0xc2, 0xdb, 0x40, 0xfa,
5);
#define NAME_AnchorSyncSvc_LastSyncProxyID L"AnchorLastSyncProxyID"
/* PKEY_AnchorSyncSvc_CurrentAnchor
*
* Contains a blob of data representing the current anchor for the device.
* As the anchor may be transient depending on the current state of the sync
* the value of PKEY_AnchorSyncSvc_CurrentAnchor may not reflect the current
* state of the database unless the current session holds a lock (via the
* BeginSync method) on the service.
*
* Type: AUInt8
* Form: BinaryArray
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorSyncSvc_CurrentAnchor,
0xe65b8fb7, 0x8fc7, 0x4278, 0xb9, 0xa3, 0xba, 0x14, 0xc2, 0xdb, 0x40, 0xfa,
6);
#define NAME_AnchorSyncSvc_CurrentAnchor L"AnchorCurrentAnchor"
/* PKEY_AnchorSyncSvc_ProviderVersion
*
* Contains a device defined value giving the version of the provider
* currently in use on the device. This version must be incremented whenever
* new properties are added to the device implementation so that they will
* be recognized and managed as part of synchronization. 0 is reserved.
*
* Type: UInt16
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorSyncSvc_ProviderVersion,
0xe65b8fb7, 0x8fc7, 0x4278, 0xb9, 0xa3, 0xba, 0x14, 0xc2, 0xdb, 0x40, 0xfa,
7);
#define NAME_AnchorSyncSvc_ProviderVersion L"AnchorProviderVersion"
/* PKEY_AnchorSyncSvc_SyncFormat
*
* Indicates the format GUID for the object format that is to be used in the
* sync operation.
*
* Type: UInt128
* Form: None
*/
#define PKEY_AnchorSyncSvc_SyncFormat PKEY_SyncSvc_SyncFormat
#define NAME_AnchorSyncSvc_SyncFormat NAME_SyncSvc_SyncFormat
/* PKEY_AnchorSyncSvc_LocalOnlyDelete
*
* Boolean flag indicating whether deletes of objects on the service host
* should be treated as "local only" and not propogated to other sync
* participants. The alternative is "true sync" in which deletes on the
* service host are propogated to all other sync participants.
*
* Type: UInt8
* Form: None
*/
#define PKEY_AnchorSyncSvc_LocalOnlyDelete PKEY_SyncSvc_LocalOnlyDelete
#define NAME_AnchorSyncSvc_LocalOnlyDelete NAME_SyncSvc_LocalOnlyDelete
/* PKEY_AnchorSyncSvc_FilterType
*
* Boolean flag indicating whether the default filter is being applied to
* this endpoint. Note that the meaning of the default filter is determined
* by the content type service.
*
* Type: UInt8
* Form: None
*/
#define PKEY_AnchorSyncSvc_FilterType PKEY_SyncSvc_FilterType
#define NAME_AnchorSyncSvc_FilterType NAME_SyncSvc_FilterType
/*****************************************************************************/
/* Anchor Sync Service Object Formats */
/*****************************************************************************/
/* FORMAT_AnchorSyncKnowledge
*/
DEFINE_DEVSVCGUID(FORMAT_AnchorSyncKnowledge,
0x37c550bc, 0xf231, 0x4727, 0xbb, 0xbc, 0x4c, 0xb3, 0x3a, 0x3f, 0x3e, 0xcd);
#define NAME_AnchorSyncKnowledge L"AnchorSyncKnowledge"
/* FORMAT_AnchorSyncSvc_AnchorResults
*
* GetChangesSinceAnchor results format
*/
DEFINE_DEVSVCGUID(FORMAT_AnchorSyncSvc_AnchorResults,
0xf35527c1, 0xce4a, 0x487a, 0x9d, 0x29, 0x93, 0x83, 0x35, 0x69, 0x32, 0x1e);
#define NAME_AnchorResults L"AnchorResults"
/*****************************************************************************/
/* Anchor Sync Service Object Property Keys */
/*****************************************************************************/
DEFINE_DEVSVCGUID(NAMESPACE_AnchorResults,
0x516b5dce, 0x8d45, 0x430f, 0x80, 0x5c, 0x25, 0xe5, 0x10, 0x6d, 0x8b, 0x1f);
/* PKEY_AnchorResults_AnchorState
*
* Output parameter from GetChangesSinceAnchor method. Contains the state
* of the current anchor result:
*
* Type: UInt32
* Form: Enum
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorResults_AnchorState,
0x516b5dce, 0x8d45, 0x430f, 0x80, 0x5c, 0x25, 0xe5, 0x10, 0x6d, 0x8b, 0x1f,
2);
#define NAME_AnchorResults_AnchorState L"AnchorState"
#define ENUM_AnchorResults_AnchorStateNormal 0x00000000
#define ENUM_AnchorResults_AnchorStateInvalid 0x00000001
#define ENUM_AnchorResults_AnchorStateOld 0x00000002
/* PKEY_AnchorResults_Anchor
*
* Input parameter for GetChangesSinceAnchor method. Contains the anchor for
* which data is being requested.
*
* Type: AUInt8
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorResults_Anchor,
0x516b5dce, 0x8d45, 0x430f, 0x80, 0x5c, 0x25, 0xe5, 0x10, 0x6d, 0x8b, 0x1f,
3);
#define NAME_AnchorResults_Anchor L"Anchor"
/* PKEY_AnchorResults_ResultObjectID
*
* Output parameter from GetChangesSinceAnchor method. Contains the object
* ID of the AnchorResults object that has the results of the
* GetChangesSinceAnchor operation.
*
* Type: UInt32
* Form: Object ID
*/
DEFINE_DEVSVCPROPKEY(PKEY_AnchorResults_ResultObjectID,
0x516b5dce, 0x8d45, 0x430f, 0x80, 0x5c, 0x25, 0xe5, 0x10, 0x6d, 0x8b, 0x1f,
4);
#define NAME_AnchorResults_ResultObjectID L"ResultObjectID"
/*****************************************************************************/
/* Anchor Sync Service Methods */
/*****************************************************************************/
/* METHOD_AnchorSyncSvc_GetChangesSinceAnchor
*/
DEFINE_DEVSVCGUID(METHOD_AnchorSyncSvc_GetChangesSinceAnchor,
0x37c550bc, 0xf231, 0x4727, 0xbb, 0xbc, 0x4c, 0xb3, 0x3a, 0x3f, 0x3e, 0xcd);
#define NAME_AnchorSyncSvc_GetChangesSinceAnchor L"GetChangesSinceAnchor"
/* Inherited methods
*/
#define METHOD_AnchorSyncSvc_BeginSync METHOD_SyncSvc_BeginSync
#define NAME_AnchorSyncSvc_BeginSync NAME_SyncSvc_BeginSync
#define METHOD_AnchorSyncSvc_EndSync METHOD_SyncSvc_EndSync
#define NAME_AnchorSyncSvc_EndSync NAME_SyncSvc_EndSync
/*****************************************************************************/
/* Anchor Sync Service Additional Defines */
/*****************************************************************************/
/* ENUM_AnchorResults_ItemState*
*
* This enum is used when encoding the Anchor results stream. It defines the
* current state of an object. If a device is capable of distinguishing
* between item update and create operations the *_ItemStateCreated and
* *_ItemStateUpdated enumerations should be used. If the device cannot
* distinuish between a create and an up updated the *_ItemStateChanged result
* should be used.
*
* Type: UInt32
* Form: Enum
*/
#define ENUM_AnchorResults_ItemStateInvalid 0x00000000
#define ENUM_AnchorResults_ItemStateDeleted 0x00000001
#define ENUM_AnchorResults_ItemStateCreated 0x00000002
#define ENUM_AnchorResults_ItemStateUpdated 0x00000003
#define ENUM_AnchorResults_ItemStateChanged 0x00000004
#endif /* _ANCHORSYNCSERVICE_H_ */

View File

@ -0,0 +1,695 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
ata.h
Abstract:
Defines the structures used by ATA port and the miniport drivers.
Authors:
Revision History:
--*/
#ifndef _NTATA_
#define _NTATA_
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning(disable:4214) // bit field types other than int
//
// IDENTIFY device data (response to 0xEC)
//
#pragma pack(push, id_device_data, 1)
typedef struct _IDENTIFY_DEVICE_DATA {
struct {
USHORT Reserved1 : 1;
USHORT Retired3 : 1;
USHORT ResponseIncomplete : 1;
USHORT Retired2 : 3;
USHORT FixedDevice : 1;
USHORT RemovableMedia : 1;
USHORT Retired1 : 7;
USHORT DeviceType : 1;
} GeneralConfiguration; // word 0
USHORT NumCylinders; // word 1
USHORT ReservedWord2;
USHORT NumHeads; // word 3
USHORT Retired1[2];
USHORT NumSectorsPerTrack; // word 6
USHORT VendorUnique1[3];
UCHAR SerialNumber[20]; // word 10-19
USHORT Retired2[2];
USHORT Obsolete1;
UCHAR FirmwareRevision[8]; // word 23-26
UCHAR ModelNumber[40]; // word 27-46
UCHAR MaximumBlockTransfer; // word 47
UCHAR VendorUnique2;
USHORT ReservedWord48;
struct {
UCHAR ReservedByte49;
UCHAR DmaSupported : 1;
UCHAR LbaSupported : 1;
UCHAR IordyDisable : 1;
UCHAR IordySupported : 1;
UCHAR Reserved1 : 1;
UCHAR StandybyTimerSupport : 1;
UCHAR Reserved2 : 2;
USHORT ReservedWord50;
}Capabilities; // word 49-50
USHORT ObsoleteWords51[2];
USHORT TranslationFieldsValid:3; // word 53
USHORT Reserved3:13;
USHORT NumberOfCurrentCylinders; // word 54
USHORT NumberOfCurrentHeads; // word 55
USHORT CurrentSectorsPerTrack; // word 56
ULONG CurrentSectorCapacity; // word 57
UCHAR CurrentMultiSectorSetting; // word 58
UCHAR MultiSectorSettingValid : 1;
UCHAR ReservedByte59 : 7;
ULONG UserAddressableSectors; // word 60-61
USHORT ObsoleteWord62;
USHORT MultiWordDMASupport : 8; // word 63
USHORT MultiWordDMAActive : 8;
USHORT AdvancedPIOModes : 8;
USHORT ReservedByte64 : 8;
USHORT MinimumMWXferCycleTime;
USHORT RecommendedMWXferCycleTime;
USHORT MinimumPIOCycleTime;
USHORT MinimumPIOCycleTimeIORDY;
USHORT ReservedWords69[6];
USHORT QueueDepth : 5;
USHORT ReservedWord75 : 11;
USHORT ReservedWords76[4];
USHORT MajorRevision;
USHORT MinorRevision;
struct {
//
// Word 82
//
USHORT SmartCommands : 1;
USHORT SecurityMode : 1;
USHORT RemovableMediaFeature : 1;
USHORT PowerManagement : 1;
USHORT Reserved1 : 1;
USHORT WriteCache : 1;
USHORT LookAhead : 1;
USHORT ReleaseInterrupt : 1;
USHORT ServiceInterrupt : 1;
USHORT DeviceReset : 1;
USHORT HostProtectedArea : 1;
USHORT Obsolete1 : 1;
USHORT WriteBuffer : 1;
USHORT ReadBuffer : 1;
USHORT Nop : 1;
USHORT Obsolete2 : 1;
//
// Word 83
//
USHORT DownloadMicrocode : 1;
USHORT DmaQueued : 1;
USHORT Cfa : 1;
USHORT AdvancedPm : 1;
USHORT Msn : 1;
USHORT PowerUpInStandby : 1;
USHORT ManualPowerUp : 1;
USHORT Reserved2 : 1;
USHORT SetMax : 1;
USHORT Acoustics : 1;
USHORT BigLba : 1;
USHORT DeviceConfigOverlay : 1;
USHORT FlushCache : 1;
USHORT FlushCacheExt : 1;
USHORT Resrved3 : 2;
//
// Word 84
//
USHORT SmartErrorLog : 1;
USHORT SmartSelfTest : 1;
USHORT MediaSerialNumber : 1;
USHORT MediaCardPassThrough : 1;
USHORT StreamingFeature : 1;
USHORT GpLogging : 1;
USHORT WriteFua : 1;
USHORT WriteQueuedFua : 1;
USHORT WWN64Bit : 1;
USHORT URGReadStream : 1;
USHORT URGWriteStream : 1;
USHORT ReservedForTechReport : 2;
USHORT IdleWithUnloadFeature : 1;
USHORT Reserved4 : 2;
}CommandSetSupport;
struct {
//
// Word 85
//
USHORT SmartCommands : 1;
USHORT SecurityMode : 1;
USHORT RemovableMediaFeature : 1;
USHORT PowerManagement : 1;
USHORT Reserved1 : 1;
USHORT WriteCache : 1;
USHORT LookAhead : 1;
USHORT ReleaseInterrupt : 1;
USHORT ServiceInterrupt : 1;
USHORT DeviceReset : 1;
USHORT HostProtectedArea : 1;
USHORT Obsolete1 : 1;
USHORT WriteBuffer : 1;
USHORT ReadBuffer : 1;
USHORT Nop : 1;
USHORT Obsolete2 : 1;
//
// Word 86
//
USHORT DownloadMicrocode : 1;
USHORT DmaQueued : 1;
USHORT Cfa : 1;
USHORT AdvancedPm : 1;
USHORT Msn : 1;
USHORT PowerUpInStandby : 1;
USHORT ManualPowerUp : 1;
USHORT Reserved2 : 1;
USHORT SetMax : 1;
USHORT Acoustics : 1;
USHORT BigLba : 1;
USHORT DeviceConfigOverlay : 1;
USHORT FlushCache : 1;
USHORT FlushCacheExt : 1;
USHORT Resrved3 : 2;
//
// Word 87
//
USHORT SmartErrorLog : 1;
USHORT SmartSelfTest : 1;
USHORT MediaSerialNumber : 1;
USHORT MediaCardPassThrough : 1;
USHORT StreamingFeature : 1;
USHORT GpLogging : 1;
USHORT WriteFua : 1;
USHORT WriteQueuedFua : 1;
USHORT WWN64Bit : 1;
USHORT URGReadStream : 1;
USHORT URGWriteStream : 1;
USHORT ReservedForTechReport : 2;
USHORT IdleWithUnloadFeature : 1;
USHORT Reserved4 : 2;
}CommandSetActive;
USHORT UltraDMASupport : 8; // word 88
USHORT UltraDMAActive : 8;
USHORT ReservedWord89[4];
USHORT HardwareResetResult;
USHORT CurrentAcousticValue : 8;
USHORT RecommendedAcousticValue : 8;
USHORT ReservedWord95[5];
ULONG Max48BitLBA[2]; // word 100-103
USHORT StreamingTransferTime;
USHORT ReservedWord105;
struct {
USHORT LogicalSectorsPerPhysicalSector : 4;
USHORT Reserved0 : 8;
USHORT LogicalSectorLongerThan256Words : 1;
USHORT MultipleLogicalSectorsPerPhysicalSector : 1;
USHORT Reserved1 : 2;
} PhysicalLogicalSectorSize; // word 106
USHORT InterSeekDelay; //word 107
USHORT WorldWideName[4]; //words 108-111
USHORT ReservedForWorldWideName128[4]; //words 112-115
USHORT ReservedForTlcTechnicalReport; //word 116
USHORT WordsPerLogicalSector[2]; //words 117-118
struct {
USHORT ReservedForDrqTechnicalReport : 1;
USHORT WriteReadVerifySupported : 1;
USHORT Reserved0 : 11;
USHORT Reserved1 : 2;
}CommandSetSupportExt; //word 119
struct {
USHORT ReservedForDrqTechnicalReport : 1;
USHORT WriteReadVerifyEnabled : 1;
USHORT Reserved0 : 11;
USHORT Reserved1 : 2;
}CommandSetActiveExt; //word 120
USHORT ReservedForExpandedSupportandActive[6];
USHORT MsnSupport : 2; //word 127
USHORT ReservedWord127 : 14;
struct { //word 128
USHORT SecuritySupported : 1;
USHORT SecurityEnabled : 1;
USHORT SecurityLocked : 1;
USHORT SecurityFrozen : 1;
USHORT SecurityCountExpired : 1;
USHORT EnhancedSecurityEraseSupported : 1;
USHORT Reserved0 : 2;
USHORT SecurityLevel : 1;
USHORT Reserved1 : 7;
} SecurityStatus;
USHORT ReservedWord129[31];
struct { //word 160
USHORT MaximumCurrentInMA : 12;
USHORT CfaPowerMode1Disabled : 1;
USHORT CfaPowerMode1Required : 1;
USHORT Reserved0 : 1;
USHORT Word160Supported : 1;
} CfaPowerMode1;
USHORT ReservedForCfaWord161[8]; //Words 161-168
struct { //Word 169
USHORT SupportsTrim : 1;
USHORT Reserved0 : 15;
} DataSetManagementFeature;
USHORT ReservedForCfaWord170[6]; //Words 170-175
USHORT CurrentMediaSerialNumber[30]; //Words 176-205
USHORT ReservedWord206; //Word 206
USHORT ReservedWord207[2]; //Words 207-208
struct { //Word 209
USHORT AlignmentOfLogicalWithinPhysical: 14;
USHORT Word209Supported: 1;
USHORT Reserved0: 1;
} BlockAlignment;
USHORT WriteReadVerifySectorCountMode3Only[2]; //Words 210-211
USHORT WriteReadVerifySectorCountMode2Only[2]; //Words 212-213
struct {
USHORT NVCachePowerModeEnabled: 1;
USHORT Reserved0: 3;
USHORT NVCacheFeatureSetEnabled: 1;
USHORT Reserved1: 3;
USHORT NVCachePowerModeVersion: 4;
USHORT NVCacheFeatureSetVersion: 4;
} NVCacheCapabilities; //Word 214
USHORT NVCacheSizeLSW; //Word 215
USHORT NVCacheSizeMSW; //Word 216
USHORT NominalMediaRotationRate; //Word 217; value 0001h means non-rotating media.
USHORT ReservedWord218; //Word 218
struct {
UCHAR NVCacheEstimatedTimeToSpinUpInSeconds;
UCHAR Reserved;
} NVCacheOptions; //Word 219
USHORT ReservedWord220[35]; //Words 220-254
USHORT Signature : 8; //Word 255
USHORT CheckSum : 8;
} IDENTIFY_DEVICE_DATA, *PIDENTIFY_DEVICE_DATA;
#pragma pack (pop, id_device_data)
//
// identify packet data (response to 0xA1)
//
#pragma pack (push, id_packet_data, 1)
typedef struct _IDENTIFY_PACKET_DATA {
struct {
USHORT PacketType : 2;
USHORT Reserved1 : 3;
USHORT DrqDelay : 2;
USHORT RemovableMedia : 1;
USHORT CommandPacketType : 5;
USHORT Reserved2 : 1;
USHORT DeviceType : 2;
}GeneralConfiguration;
USHORT ResevedWord1;
USHORT UniqueConfiguration;
USHORT ReservedWords3[7];
USHORT SerialNumber[10];
USHORT ReservedWords20[3];
USHORT FirmwareRevision[4];
USHORT ModelNumber[20];
USHORT ReservedWords47[2];
struct {
USHORT VendorSpecific : 8;
USHORT DmaSupported : 1;
USHORT LbaSupported : 1;
USHORT IordyDisabled : 1;
USHORT IordySupported : 1;
USHORT Obsolete : 1;
USHORT OverlapSupported : 1;
USHORT QueuedCommandsSupported : 1;
USHORT InterleavedDmaSupported : 1;
} Capabilities;
USHORT ReservedWord50;
USHORT ObsoleteWords51[2];
USHORT TranslationFieldsValid:3;
USHORT Reserved3:13;
USHORT ReservedWords54[9];
USHORT MultiWordDMASupport : 8; // word 63
USHORT MultiWordDMAActive : 8;
USHORT AdvancedPIOModes : 8;
USHORT ReservedByte64 : 8;
USHORT MinimumMWXferCycleTime;
USHORT RecommendedMWXferCycleTime;
USHORT MinimumPIOCycleTime;
USHORT MinimumPIOCycleTimeIORDY;
USHORT ReservedWords69[2];
USHORT BusReleaseDelay;
USHORT ServiceCommandDelay;
USHORT ReservedWords73[2];
USHORT QueueDepth : 5;
USHORT ReservedWord75 : 11;
USHORT ReservedWords76[4];
USHORT MajorRevision;
USHORT MinorRevision;
struct {
USHORT SmartCommands : 1;
USHORT SecurityMode : 1;
USHORT RemovableMedia : 1;
USHORT PowerManagement : 1;
USHORT PacketCommands : 1;
USHORT WriteCache : 1;
USHORT LookAhead : 1;
USHORT ReleaseInterrupt : 1;
USHORT ServiceInterrupt : 1;
USHORT DeviceReset : 1;
USHORT HostProtectedArea : 1;
USHORT Obsolete1 : 1;
USHORT WriteBuffer : 1;
USHORT ReadBuffer : 1;
USHORT Nop : 1;
USHORT Obsolete2 : 1;
USHORT DownloadMicrocode : 1;
USHORT Reserved1 : 3;
USHORT Msn : 1;
USHORT PowerUpInStandby : 1;
USHORT ManualPowerUp : 1;
USHORT Reserved2 : 1;
USHORT SetMax : 1;
USHORT Reserved3 : 7;
} CommandSetSupport;
USHORT ReservedWord84;
struct {
USHORT SmartCommands : 1;
USHORT SecurityMode : 1;
USHORT RemovableMedia : 1;
USHORT PowerManagement : 1;
USHORT PacketCommands : 1;
USHORT WriteCache : 1;
USHORT LookAhead : 1;
USHORT ReleaseInterrupt : 1;
USHORT ServiceInterrupt : 1;
USHORT DeviceReset : 1;
USHORT HostProtectedArea : 1;
USHORT Obsolete1 : 1;
USHORT WriteBuffer : 1;
USHORT ReadBuffer : 1;
USHORT Nop : 1;
USHORT Obsolete2 : 1;
USHORT DownloadMicrocode : 1;
USHORT Reserved1 : 3;
USHORT Msn : 1;
USHORT PowerUpInStandby : 1;
USHORT ManualPowerUp : 1;
USHORT Reserved2 : 1;
USHORT SetMax : 1;
USHORT Reserved : 7;
} CommandSetActive;
USHORT ReservedWord87;
USHORT UltraDMASupport : 8; // word 88
USHORT UltraDMAActive : 8;
USHORT ReservedWords89[4];
USHORT HardwareResetResult;
USHORT ReservedWords94[32];
USHORT AtapiZeroByteCount;
USHORT MsnSupport : 2;
USHORT ReservedWord127 : 14;
USHORT SecurityStatus;
USHORT ReservedWord129[126];
USHORT Signature : 8;
USHORT CheckSum : 8;
} IDENTIFY_PACKET_DATA, *PIDENTIFY_PACKET_DATA;
#pragma pack (pop, id_packet_data)
//
// Register FIS
//
#pragma pack (push, regfis, 1)
typedef struct _REGISTER_FIS {
//
// dword 0
//
UCHAR FisType;
UCHAR Reserved0 : 7;
UCHAR CmdReg : 1;
UCHAR Command;
UCHAR Features;
//
// dword 1
//
UCHAR SectorNumber;
UCHAR CylinderLow;
UCHAR CylinderHigh;
UCHAR DeviceHead;
//
// dword 2
//
UCHAR SectorNumberExp;
UCHAR CylinderLowExp;
UCHAR CylinderHighExp;
UCHAR FeaturesExp;
//
// dword 3
//
UCHAR SectorCount;
UCHAR SectorCountExp;
UCHAR Reserved2;
UCHAR Control;
//
// dword 4
//
ULONG Reserved3;
}REGISTER_FIS, *PREGISTER_FIS;
#pragma pack (pop, regfis)
//
// ATAPI specific scsiops
//
#define ATAPI_MODE_SENSE 0x5A
#define ATAPI_MODE_SELECT 0x55
#define ATAPI_LS120_FORMAT_UNIT 0x24
//
// IDE driveSelect register bit for LBA mode
//
#define IDE_LBA_MODE (1 << 6)
//
// IDE drive control definitions
//
#define IDE_DC_DISABLE_INTERRUPTS 0x02
#define IDE_DC_RESET_CONTROLLER 0x04
#define IDE_DC_REENABLE_CONTROLLER 0x00
//
// IDE status definitions
//
#define IDE_STATUS_ERROR 0x01
#define IDE_STATUS_INDEX 0x02
#define IDE_STATUS_CORRECTED_ERROR 0x04
#define IDE_STATUS_DRQ 0x08
#define IDE_STATUS_DSC 0x10
#define IDE_STATUS_DRDY 0x40
#define IDE_STATUS_IDLE 0x50
#define IDE_STATUS_BUSY 0x80
//
// IDE error definitions
//
#define IDE_ERROR_BAD_BLOCK 0x80
#define IDE_ERROR_CRC_ERROR IDE_ERROR_BAD_BLOCK
#define IDE_ERROR_DATA_ERROR 0x40
#define IDE_ERROR_MEDIA_CHANGE 0x20
#define IDE_ERROR_ID_NOT_FOUND 0x10
#define IDE_ERROR_MEDIA_CHANGE_REQ 0x08
#define IDE_ERROR_COMMAND_ABORTED 0x04
#define IDE_ERROR_END_OF_MEDIA 0x02
#define IDE_ERROR_ILLEGAL_LENGTH 0x01
#define IDE_ERROR_ADDRESS_NOT_FOUND IDE_ERROR_ILLEGAL_LENGTH
//
// IDE command definitions
//
#define IDE_COMMAND_NOP 0x00
#define IDE_COMMAND_DATA_SET_MANAGEMENT 0x06
#define IDE_COMMAND_ATAPI_RESET 0x08
#define IDE_COMMAND_READ 0x20
#define IDE_COMMAND_READ_EXT 0x24
#define IDE_COMMAND_READ_DMA_EXT 0x25
#define IDE_COMMAND_READ_DMA_QUEUED_EXT 0x26
#define IDE_COMMAND_READ_MULTIPLE_EXT 0x29
#define IDE_COMMAND_WRITE 0x30
#define IDE_COMMAND_WRITE_EXT 0x34
#define IDE_COMMAND_WRITE_DMA_EXT 0x35
#define IDE_COMMAND_WRITE_DMA_QUEUED_EXT 0x36
#define IDE_COMMAND_WRITE_MULTIPLE_EXT 0x39
#define IDE_COMMAND_WRITE_DMA_FUA_EXT 0x3D
#define IDE_COMMAND_WRITE_DMA_QUEUED_FUA_EXT 0x3E
#define IDE_COMMAND_VERIFY 0x40
#define IDE_COMMAND_VERIFY_EXT 0x42
#define IDE_COMMAND_EXECUTE_DEVICE_DIAGNOSTIC 0x90
#define IDE_COMMAND_SET_DRIVE_PARAMETERS 0x91
#define IDE_COMMAND_ATAPI_PACKET 0xA0
#define IDE_COMMAND_ATAPI_IDENTIFY 0xA1
#define IDE_COMMAND_SMART 0xB0
#define IDE_COMMAND_READ_MULTIPLE 0xC4
#define IDE_COMMAND_WRITE_MULTIPLE 0xC5
#define IDE_COMMAND_SET_MULTIPLE 0xC6
#define IDE_COMMAND_READ_DMA 0xC8
#define IDE_COMMAND_WRITE_DMA 0xCA
#define IDE_COMMAND_WRITE_DMA_QUEUED 0xCC
#define IDE_COMMAND_WRITE_MULTIPLE_FUA_EXT 0xCE
#define IDE_COMMAND_GET_MEDIA_STATUS 0xDA
#define IDE_COMMAND_DOOR_LOCK 0xDE
#define IDE_COMMAND_DOOR_UNLOCK 0xDF
#define IDE_COMMAND_STANDBY_IMMEDIATE 0xE0
#define IDE_COMMAND_IDLE_IMMEDIATE 0xE1
#define IDE_COMMAND_CHECK_POWER 0xE5
#define IDE_COMMAND_SLEEP 0xE6
#define IDE_COMMAND_FLUSH_CACHE 0xE7
#define IDE_COMMAND_FLUSH_CACHE_EXT 0xEA
#define IDE_COMMAND_IDENTIFY 0xEC
#define IDE_COMMAND_MEDIA_EJECT 0xED
#define IDE_COMMAND_SET_FEATURE 0xEF
#define IDE_COMMAND_SECURITY_FREEZE_LOCK 0xF5
#define IDE_COMMAND_NOT_VALID 0xFF
//
// IDE Set Transfer Mode
//
#define IDE_SET_DEFAULT_PIO_MODE(mode) ((UCHAR) 1) // disable I/O Ready
#define IDE_SET_ADVANCE_PIO_MODE(mode) ((UCHAR) ((1 << 3) | (mode)))
#define IDE_SET_SWDMA_MODE(mode) ((UCHAR) ((1 << 4) | (mode)))
#define IDE_SET_MWDMA_MODE(mode) ((UCHAR) ((1 << 5) | (mode)))
#define IDE_SET_UDMA_MODE(mode) ((UCHAR) ((1 << 6) | (mode)))
//
// Set features parameter list
//
#define IDE_FEATURE_ENABLE_WRITE_CACHE 0x2
#define IDE_FEATURE_SET_TRANSFER_MODE 0x3
#define IDE_FEATURE_ENABLE_SATA_FEATURE 0x10
#define IDE_FEATURE_DISABLE_MSN 0x31
#define IDE_FEATURE_DISABLE_REVERT_TO_POWER_ON 0x66
#define IDE_FEATURE_DISABLE_WRITE_CACHE 0x82
#define IDE_FEATURE_DISABLE_SATA_FEATURE 0x90
#define IDE_FEATURE_ENABLE_MSN 0x95
//
// SATA Features Sector Count parameter list
//
#define IDE_SATA_FEATURE_NON_ZERO_DMA_BUFFER_OFFSET 0x1
#define IDE_SATA_FEATURE_DMA_SETUP_FIS_AUTO_ACTIVATE 0x2
#define IDE_SATA_FEATURE_DEVICE_INITIATED_POWER_MANAGEMENT 0x3
#define IDE_SATA_FEATURE_GUARANTEED_IN_ORDER_DELIVERY 0x4
#define IDE_SATA_FEATURE_ASYNCHRONOUS_NOTIFICATION 0x5
#define IDE_SATA_FEATURE_SOFTWARE_SETTINGS_PRESERVATION 0x6
//
// SMART sub command list
//
#define IDE_SMART_READ_ATTRIBUTES 0xD0
#define IDE_SMART_READ_THRESHOLDS 0xD1
#define IDE_SMART_ENABLE_DISABLE_AUTOSAVE 0xD2
#define IDE_SMART_SAVE_ATTRIBUTE_VALUES 0xD3
#define IDE_SMART_EXECUTE_OFFLINE_DIAGS 0xD4
#define IDE_SMART_READ_LOG 0xD5
#define IDE_SMART_WRITE_LOG 0xD6
#define IDE_SMART_ENABLE 0xD8
#define IDE_SMART_DISABLE 0xD9
#define IDE_SMART_RETURN_STATUS 0xDA
#define IDE_SMART_ENABLE_DISABLE_AUTO_OFFLINE 0xDB
//
// Features for IDE_COMMAND_DATA_SET_MANAGEMENT
//
#define IDE_DSM_FEATURE_TRIM 0x0001 //bit 0 of WORD
#if _MSC_VER >= 1200
#pragma warning(pop)
#else
#pragma warning(default:4214)
#endif
#endif

View File

@ -0,0 +1,785 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
atm.h
Abstract:
This module defines the structures, macros, and manifests available
to ATM aware components.
Author:
NDIS/ATM Development Team
Revision History:
Initial Version - March 1996
--*/
#ifndef _ATM_H_
#define _ATM_H_
#pragma once
//
// Address type
//
typedef ULONG ATM_ADDRESSTYPE;
#define ATM_NSAP 0
#define ATM_E164 1
//
// ATM Address
//
#define ATM_MAC_ADDRESS_LENGTH 6 // Same as 802.x
#define ATM_ADDRESS_LENGTH 20
//
// Special characters in ATM address string used in textual representations
//
#define ATM_ADDR_BLANK_CHAR L' '
#define ATM_ADDR_PUNCTUATION_CHAR L'.'
#define ATM_ADDR_E164_START_CHAR L'+'
typedef struct _ATM_ADDRESS
{
ATM_ADDRESSTYPE AddressType;
ULONG NumberOfDigits;
UCHAR Address[ATM_ADDRESS_LENGTH];
} ATM_ADDRESS, *PATM_ADDRESS;
//
// AAL types that the miniport supports
//
#define AAL_TYPE_AAL0 1
#define AAL_TYPE_AAL1 2
#define AAL_TYPE_AAL34 4
#define AAL_TYPE_AAL5 8
typedef ULONG ATM_AAL_TYPE, *PATM_AAL_TYPE;
//
// Types of Information Elements
//
typedef enum
{
IE_AALParameters,
IE_TrafficDescriptor,
IE_BroadbandBearerCapability,
IE_BHLI,
IE_BLLI,
IE_CalledPartyNumber,
IE_CalledPartySubaddress,
IE_CallingPartyNumber,
IE_CallingPartySubaddress,
IE_Cause,
IE_QOSClass,
IE_TransitNetworkSelection,
IE_BroadbandSendingComplete,
IE_LIJCallId,
IE_Raw
} Q2931_IE_TYPE;
//
// Common header for each Information Element
//
typedef struct _Q2931_IE
{
Q2931_IE_TYPE IEType;
ULONG IELength; // Bytes, including IEType and IELength fields
UCHAR IE[1];
} Q2931_IE, *PQ2931_IE;
//
// Definitions for SapType in CO_SAP
//
#define SAP_TYPE_NSAP 0x00000001
#define SAP_TYPE_E164 0x00000002
//
// Values used for the Mode field in AAL5_PARAMETERS
//
#define AAL5_MODE_MESSAGE 0x01
#define AAL5_MODE_STREAMING 0x02
//
// Values used for the SSCSType field in AAL5_PARAMETERS
//
#define AAL5_SSCS_NULL 0x00
#define AAL5_SSCS_SSCOP_ASSURED 0x01
#define AAL5_SSCS_SSCOP_NON_ASSURED 0x02
#define AAL5_SSCS_FRAME_RELAY 0x04
//
// AAL Parameters
//
typedef struct _AAL1_PARAMETERS
{
UCHAR Subtype;
UCHAR CBRRate;
USHORT Multiplier;
UCHAR SourceClockRecoveryMethod;
UCHAR ErrorCorrectionMethod;
USHORT StructuredDataTransferBlocksize;
UCHAR PartiallyFilledCellsMethod;
} AAL1_PARAMETERS, *PAAL1_PARAMETERS;
typedef struct _AAL34_PARAMETERS
{
USHORT ForwardMaxCPCSSDUSize;
USHORT BackwardMaxCPCSSDUSize;
USHORT LowestMID;
USHORT HighestMID;
UCHAR SSCSType;
} AAL34_PARAMETERS, *PAAL34_PARAMETERS;
typedef struct _AAL5_PARAMETERS
{
ULONG ForwardMaxCPCSSDUSize;
ULONG BackwardMaxCPCSSDUSize;
UCHAR Mode;
UCHAR SSCSType;
} AAL5_PARAMETERS, *PAAL5_PARAMETERS;
typedef struct _AALUSER_PARAMETERS
{
ULONG UserDefined;
} AALUSER_PARAMETERS, *PAALUSER_PARAMETERS;
typedef struct _AAL_PARAMETERS_IE
{
ATM_AAL_TYPE AALType;
union
{
AAL1_PARAMETERS AAL1Parameters;
AAL34_PARAMETERS AAL34Parameters;
AAL5_PARAMETERS AAL5Parameters;
AALUSER_PARAMETERS AALUserParameters;
} AALSpecificParameters;
} AAL_PARAMETERS_IE, *PAAL_PARAMETERS_IE;
//
// ATM Traffic Descriptor
//
typedef struct _ATM_TRAFFIC_DESCRIPTOR // For one direction
{
ULONG PeakCellRateCLP0;
ULONG PeakCellRateCLP01;
ULONG SustainableCellRateCLP0;
ULONG SustainableCellRateCLP01;
ULONG MaximumBurstSizeCLP0;
ULONG MaximumBurstSizeCLP01;
BOOLEAN Tagging;
} ATM_TRAFFIC_DESCRIPTOR, *PATM_TRAFFIC_DESCRIPTOR;
typedef struct _ATM_TRAFFIC_DESCRIPTOR_IE
{
ATM_TRAFFIC_DESCRIPTOR ForwardTD;
ATM_TRAFFIC_DESCRIPTOR BackwardTD;
BOOLEAN BestEffort;
} ATM_TRAFFIC_DESCRIPTOR_IE, *PATM_TRAFFIC_DESCRIPTOR_IE;
//
// values used for the BearerClass field in the Broadband Bearer Capability IE
//
#define BCOB_A 0x00 // Bearer class A
#define BCOB_C 0x01 // Bearer class C
#define BCOB_X 0x02 // Bearer class X
//
// values used for the TrafficType field in the Broadband Bearer Capability IE
//
#define TT_NOIND 0x00 // No indication of traffic type
#define TT_CBR 0x04 // Constant bit rate
#define TT_VBR 0x08 // Variable bit rate
//
// values used for the TimingRequirements field in the Broadband Bearer Capability IE
//
#define TR_NOIND 0x00 // No timing requirement indication
#define TR_END_TO_END 0x01 // End-to-end timing required
#define TR_NO_END_TO_END 0x02 // End-to-end timing not required
//
// values used for the ClippingSusceptability field in the Broadband Bearer Capability IE
//
#define CLIP_NOT 0x00 // Not susceptible to clipping
#define CLIP_SUS 0x20 // Susceptible to clipping
//
// values used for the UserPlaneConnectionConfig field in
// the Broadband Bearer Capability IE
//
#define UP_P2P 0x00 // Point-to-point connection
#define UP_P2MP 0x01 // Point-to-multipoint connection
//
// Broadband Bearer Capability
//
typedef struct _ATM_BROADBAND_BEARER_CAPABILITY_IE
{
UCHAR BearerClass;
UCHAR TrafficType;
UCHAR TimingRequirements;
UCHAR ClippingSusceptability;
UCHAR UserPlaneConnectionConfig;
} ATM_BROADBAND_BEARER_CAPABILITY_IE, *PATM_BROADBAND_BEARER_CAPABILITY_IE;
//
// values used for the HighLayerInfoType field in ATM_BHLI
//
#define BHLI_ISO 0x00 // ISO
#define BHLI_UserSpecific 0x01 // User Specific
#define BHLI_HighLayerProfile 0x02 // High layer profile (only in UNI3.0)
#define BHLI_VendorSpecificAppId 0x03 // Vendor-Specific Application ID
//
// Broadband High layer Information
//
typedef struct _ATM_BHLI_IE
{
ULONG HighLayerInfoType; // High Layer Information Type
ULONG HighLayerInfoLength; // number of bytes in HighLayerInfo
UCHAR HighLayerInfo[8]; // The value dependent on the
// HighLayerInfoType field
} ATM_BHLI_IE, *PATM_BHLI_IE;
//
// values used for Layer2Protocol in B-LLI
//
#define BLLI_L2_ISO_1745 0x01 // Basic mode ISO 1745
#define BLLI_L2_Q921 0x02 // CCITT Rec. Q.921
#define BLLI_L2_X25L 0x06 // CCITT Rec. X.25, link layer
#define BLLI_L2_X25M 0x07 // CCITT Rec. X.25, multilink
#define BLLI_L2_ELAPB 0x08 // Extended LAPB; for half duplex operation
#define BLLI_L2_HDLC_ARM 0x09 // HDLC ARM (ISO 4335)
#define BLLI_L2_HDLC_NRM 0x0A // HDLC NRM (ISO 4335)
#define BLLI_L2_HDLC_ABM 0x0B // HDLC ABM (ISO 4335)
#define BLLI_L2_LLC 0x0C // LAN logical link control (ISO 8802/2)
#define BLLI_L2_X75 0x0D // CCITT Rec. X.75, single link procedure
#define BLLI_L2_Q922 0x0E // CCITT Rec. Q.922
#define BLLI_L2_USER_SPECIFIED 0x10 // User Specified
#define BLLI_L2_ISO_7776 0x11 // ISO 7776 DTE-DTE operation
//
// values used for Layer3Protocol in B-LLI
//
#define BLLI_L3_X25 0x06 // CCITT Rec. X.25, packet layer
#define BLLI_L3_ISO_8208 0x07 // ISO/IEC 8208 (X.25 packet layer for DTE
#define BLLI_L3_X223 0x08 // X.223/ISO 8878
#define BLLI_L3_SIO_8473 0x09 // ISO/IEC 8473 (OSI connectionless)
#define BLLI_L3_T70 0x0A // CCITT Rec. T.70 min. network layer
#define BLLI_L3_ISO_TR9577 0x0B // ISO/IEC TR 9577 Network Layer Protocol ID
#define BLLI_L3_USER_SPECIFIED 0x10 // User Specified
//
// values used for Layer3IPI in struct B-LLI
//
#define BLLI_L3_IPI_SNAP 0x80 // IEEE 802.1 SNAP identifier
#define BLLI_L3_IPI_IP 0xCC // Internet Protocol (IP) identifier
//
// Broadband Lower Layer Information
//
typedef struct _ATM_BLLI_IE
{
ULONG Layer2Protocol;
UCHAR Layer2Mode;
UCHAR Layer2WindowSize;
ULONG Layer2UserSpecifiedProtocol;
ULONG Layer3Protocol;
UCHAR Layer3Mode;
UCHAR Layer3DefaultPacketSize;
UCHAR Layer3PacketWindowSize;
ULONG Layer3UserSpecifiedProtocol;
ULONG Layer3IPI;
UCHAR SnapId[5];
} ATM_BLLI_IE, *PATM_BLLI_IE;
//
// Called Party Number
//
// If present, this IE overrides the Called Address specified in
// the main parameter block.
//
typedef ATM_ADDRESS ATM_CALLED_PARTY_NUMBER_IE;
//
// Called Party Subaddress
//
typedef ATM_ADDRESS ATM_CALLED_PARTY_SUBADDRESS_IE;
//
// Calling Party Number
//
typedef struct _ATM_CALLING_PARTY_NUMBER_IE
{
ATM_ADDRESS Number;
UCHAR PresentationIndication;
UCHAR ScreeningIndicator;
} ATM_CALLING_PARTY_NUMBER_IE, *PATM_CALLING_PARTY_NUMBER_IE;
//
// Calling Party Subaddress
//
typedef ATM_ADDRESS ATM_CALLING_PARTY_SUBADDRESS_IE;
//
// Values used for the QOSClassForward and QOSClassBackward
// fields in ATM_QOS_CLASS_IE
//
#define QOS_CLASS0 0x00
#define QOS_CLASS1 0x01
#define QOS_CLASS2 0x02
#define QOS_CLASS3 0x03
#define QOS_CLASS4 0x04
//
// QOS Class
//
typedef struct _ATM_QOS_CLASS_IE
{
UCHAR QOSClassForward;
UCHAR QOSClassBackward;
} ATM_QOS_CLASS_IE, *PATM_QOS_CLASS_IE;
//
// Broadband Sending Complete
//
typedef struct _ATM_BROADBAND_SENDING_COMPLETE_IE
{
UCHAR SendingComplete;
} ATM_BROADBAND_SENDING_COMPLETE_IE, *PATM_BROADBAND_SENDING_COMPLETE_IE;
//
// Values used for the TypeOfNetworkId field in ATM_TRANSIT_NETWORK_SELECTION_IE
//
#define TNS_TYPE_NATIONAL 0x40
//
// Values used for the NetworkIdPlan field in ATM_TRANSIT_NETWORK_SELECTION_IE
//
#define TNS_PLAN_CARRIER_ID_CODE 0x01
//
// Transit Network Selection
//
typedef struct _ATM_TRANSIT_NETWORK_SELECTION_IE
{
UCHAR TypeOfNetworkId;
UCHAR NetworkIdPlan;
UCHAR NetworkIdLength;
UCHAR NetworkId[1];
} ATM_TRANSIT_NETWORK_SELECTION_IE, *PATM_TRANSIT_NETWORK_SELECTION_IE;
//
// Values used for the Location field in struct ATM_CAUSE_IE
//
#define ATM_CAUSE_LOC_USER 0x00
#define ATM_CAUSE_LOC_PRIVATE_LOCAL 0x01
#define ATM_CAUSE_LOC_PUBLIC_LOCAL 0x02
#define ATM_CAUSE_LOC_TRANSIT_NETWORK 0x03
#define ATM_CAUSE_LOC_PUBLIC_REMOTE 0x04
#define ATM_CAUSE_LOC_PRIVATE_REMOTE 0x05
#define ATM_CAUSE_LOC_INTERNATIONAL_NETWORK 0x07
#define ATM_CAUSE_LOC_BEYOND_INTERWORKING 0x0A
//
// Values used for the Cause field in struct ATM_CAUSE_IE
//
#define ATM_CAUSE_UNALLOCATED_NUMBER 0x01
#define ATM_CAUSE_NO_ROUTE_TO_TRANSIT_NETWORK 0x02
#define ATM_CAUSE_NO_ROUTE_TO_DESTINATION 0x03
#define ATM_CAUSE_VPI_VCI_UNACCEPTABLE 0x0A
#define ATM_CAUSE_NORMAL_CALL_CLEARING 0x10
#define ATM_CAUSE_USER_BUSY 0x11
#define ATM_CAUSE_NO_USER_RESPONDING 0x12
#define ATM_CAUSE_CALL_REJECTED 0x15
#define ATM_CAUSE_NUMBER_CHANGED 0x16
#define ATM_CAUSE_USER_REJECTS_CLIR 0x17
#define ATM_CAUSE_DESTINATION_OUT_OF_ORDER 0x1B
#define ATM_CAUSE_INVALID_NUMBER_FORMAT 0x1C
#define ATM_CAUSE_STATUS_ENQUIRY_RESPONSE 0x1E
#define ATM_CAUSE_NORMAL_UNSPECIFIED 0x1F
#define ATM_CAUSE_VPI_VCI_UNAVAILABLE 0x23
#define ATM_CAUSE_NETWORK_OUT_OF_ORDER 0x26
#define ATM_CAUSE_TEMPORARY_FAILURE 0x29
#define ATM_CAUSE_ACCESS_INFORMAION_DISCARDED 0x2B
#define ATM_CAUSE_NO_VPI_VCI_AVAILABLE 0x2D
#define ATM_CAUSE_RESOURCE_UNAVAILABLE 0x2F
#define ATM_CAUSE_QOS_UNAVAILABLE 0x31
#define ATM_CAUSE_USER_CELL_RATE_UNAVAILABLE 0x33
#define ATM_CAUSE_BEARER_CAPABILITY_UNAUTHORIZED 0x39
#define ATM_CAUSE_BEARER_CAPABILITY_UNAVAILABLE 0x3A
#define ATM_CAUSE_OPTION_UNAVAILABLE 0x3F
#define ATM_CAUSE_BEARER_CAPABILITY_UNIMPLEMENTED 0x41
#define ATM_CAUSE_UNSUPPORTED_TRAFFIC_PARAMETERS 0x49
#define ATM_CAUSE_INVALID_CALL_REFERENCE 0x51
#define ATM_CAUSE_CHANNEL_NONEXISTENT 0x52
#define ATM_CAUSE_INCOMPATIBLE_DESTINATION 0x58
#define ATM_CAUSE_INVALID_ENDPOINT_REFERENCE 0x59
#define ATM_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION 0x5B
#define ATM_CAUSE_TOO_MANY_PENDING_ADD_PARTY 0x5C
#define ATM_CAUSE_AAL_PARAMETERS_UNSUPPORTED 0x5D
#define ATM_CAUSE_MANDATORY_IE_MISSING 0x60
#define ATM_CAUSE_UNIMPLEMENTED_MESSAGE_TYPE 0x61
#define ATM_CAUSE_UNIMPLEMENTED_IE 0x63
#define ATM_CAUSE_INVALID_IE_CONTENTS 0x64
#define ATM_CAUSE_INVALID_STATE_FOR_MESSAGE 0x65
#define ATM_CAUSE_RECOVERY_ON_TIMEOUT 0x66
#define ATM_CAUSE_INCORRECT_MESSAGE_LENGTH 0x68
#define ATM_CAUSE_PROTOCOL_ERROR 0x6F
//
// Values used for the Condition portion of the Diagnostics field
// in struct ATM_CAUSE_IE, for certain Cause values
//
#define ATM_CAUSE_COND_UNKNOWN 0x00
#define ATM_CAUSE_COND_PERMANENT 0x01
#define ATM_CAUSE_COND_TRANSIENT 0x02
//
// Values used for the Rejection Reason portion of the Diagnostics field
// in struct ATM_CAUSE_IE, for certain Cause values
//
#define ATM_CAUSE_REASON_USER 0x00
#define ATM_CAUSE_REASON_IE_MISSING 0x04
#define ATM_CAUSE_REASON_IE_INSUFFICIENT 0x08
//
// Values used for the P-U flag of the Diagnostics field
// in struct ATM_CAUSE_IE, for certain Cause values
//
#define ATM_CAUSE_PU_PROVIDER 0x00
#define ATM_CAUSE_PU_USER 0x08
//
// Values used for the N-A flag of the Diagnostics field
// in struct ATM_CAUSE_IE, for certain Cause values
//
#define ATM_CAUSE_NA_NORMAL 0x00
#define ATM_CAUSE_NA_ABNORMAL 0x04
//
// Cause
//
typedef struct _ATM_CAUSE_IE
{
UCHAR Location;
UCHAR Cause;
UCHAR DiagnosticsLength;
UCHAR Diagnostics[4];
} ATM_CAUSE_IE, *PATM_CAUSE_IE;
//
// Leaf Initiated Join (LIJ) Identifier
//
typedef struct _ATM_LIJ_CALLID_IE
{
ULONG Identifier;
} ATM_LIJ_CALLID_IE, *PATM_LIJ_CALLID_IE;
//
// Raw Information Element - the user can fill in whatever he wants
//
typedef struct _ATM_RAW_IE
{
ULONG RawIELength;
ULONG RawIEType;
UCHAR RawIEValue[1];
} ATM_RAW_IE, *PATM_RAW_IE;
//
// This is the value of the ParamType field in the CO_SPECIFIC_PARAMETERS structure
// when the Parameters[] field contains ATM media specific values in the structure
// ATM_MEDIA_PARAMETERS.
//
#define ATM_MEDIA_SPECIFIC 0x00000001
//
// The Q2931 Call Manager Specific parameters that goes into the
// CallMgrParameters->CallMgrSpecific.Parameters
//
typedef struct _Q2931_CALLMGR_PARAMETERS
{
ATM_ADDRESS CalledParty;
ATM_ADDRESS CallingParty;
ULONG InfoElementCount;
UCHAR InfoElements[1]; // one or more info elements
} Q2931_CALLMGR_PARAMETERS, *PQ2931_CALLMGR_PARAMETERS;
//
// This is the specific portion of either the Media parameters or the CallMgr
// Parameters. The following two defines are used in the ParamType field
// depending on the signaling type.
//
#define CALLMGR_SPECIFIC_Q2931 0x00000001
typedef struct _ATM_VPIVCI
{
ULONG Vpi;
ULONG Vci;
} ATM_VPIVCI, *PATM_VPIVCI;
//
// ATM Service Category
//
#define ATM_SERVICE_CATEGORY_CBR 1 // Constant Bit Rate
#define ATM_SERVICE_CATEGORY_VBR 2 // Variable Bit Rate
#define ATM_SERVICE_CATEGORY_UBR 4 // Unspecified Bit Rate
#define ATM_SERVICE_CATEGORY_ABR 8 // Available Bit Rate
typedef ULONG ATM_SERVICE_CATEGORY, *PATM_SERVICE_CATEGORY;
//
// ATM flow parameters for use in specifying Media parameters
//
typedef struct _ATM_FLOW_PARAMETERS
{
ATM_SERVICE_CATEGORY ServiceCategory;
ULONG AverageCellRate; // in cells/sec
ULONG PeakCellRate; // in cells/sec
ULONG MinimumCellRate; // in cells/sec (ABR MCR)
ULONG InitialCellRate; // in cells/sec (ABR ICR)
ULONG BurstLengthCells; // in cells
ULONG MaxSduSize; // MTU in bytes
ULONG TransientBufferExposure; // in cells (ABR TBE)
ULONG CumulativeRMFixedRTT; // in microseconds (ABR FRTT)
UCHAR RateIncreaseFactor; // UNI 4.0 coding (ABR RIF)
UCHAR RateDecreaseFactor; // UNI 4.0 coding (ABR RDF)
USHORT ACRDecreaseTimeFactor; // UNI 4.0 coding (ABR ADTF)
UCHAR MaximumCellsPerForwardRMCell; // UNI 4.0 coding (ABR Nrm)
UCHAR MaximumForwardRMCellInterval; // UNI 4.0 coding (ABR Trm)
UCHAR CutoffDecreaseFactor; // UNI 4.0 coding (ABR CDF)
UCHAR Reserved1; // padding
ULONG MissingRMCellCount; // (ABR CRM)
ULONG Reserved2;
ULONG Reserved3;
} ATM_FLOW_PARAMETERS, *PATM_FLOW_PARAMETERS;
//
// ATM Specific Media parameters - this is the Media specific structure for ATM
// that goes into MediaParameters->MediaSpecific.Parameters.
//
typedef struct _ATM_MEDIA_PARAMETERS
{
ATM_VPIVCI ConnectionId;
ATM_AAL_TYPE AALType;
ULONG CellDelayVariationCLP0;
ULONG CellDelayVariationCLP1;
ULONG CellLossRatioCLP0;
ULONG CellLossRatioCLP1;
ULONG CellTransferDelayCLP0;
ULONG CellTransferDelayCLP1;
ULONG DefaultCLP;
ATM_FLOW_PARAMETERS Transmit;
ATM_FLOW_PARAMETERS Receive;
} ATM_MEDIA_PARAMETERS, *PATM_MEDIA_PARAMETERS;
// Bit 0 in Reserved1 in ATM_FLOW_PARAMETERS is reserved.
#define ATM_FLOW_PARAMS_RSVD1_MPP 0x01
#ifndef SAP_FIELD_ABSENT
#define SAP_FIELD_ABSENT ((ULONG)0xfffffffe)
#endif
#ifndef SAP_FIELD_ANY
#define SAP_FIELD_ANY ((ULONG)0xffffffff)
#endif
#define SAP_FIELD_ANY_AESA_SEL ((ULONG)0xfffffffa) // SEL is wild-carded
#define SAP_FIELD_ANY_AESA_REST ((ULONG)0xfffffffb) // All of the address
// except SEL, is wild-carded
//
// The ATM Specific SAP definition
//
typedef struct _ATM_SAP
{
ATM_BLLI_IE Blli;
ATM_BHLI_IE Bhli;
ULONG NumberOfAddresses;
UCHAR Addresses[1]; // each of type ATM_ADDRESS
} ATM_SAP, *PATM_SAP;
//
// The ATM Specific SAP definition when adding PVCs
//
typedef struct _ATM_PVC_SAP
{
ATM_BLLI_IE Blli;
ATM_BHLI_IE Bhli;
} ATM_PVC_SAP, *PATM_PVC_SAP;
//
// The structure passed in the Parameters field of the CO_SPECIFIC_PARAMETERS
// structure passed in an ADD PVC request for Q.2931
//
typedef struct _Q2931_ADD_PVC
{
ATM_ADDRESS CalledParty;
ATM_ADDRESS CallingParty;
ATM_VPIVCI ConnectionId;
ATM_AAL_TYPE AALType;
ATM_FLOW_PARAMETERS ForwardFP;
ATM_FLOW_PARAMETERS BackwardFP;
ULONG Flags;
ATM_PVC_SAP LocalSap;
ATM_PVC_SAP DestinationSap;
BOOLEAN LIJIdPresent;
ATM_LIJ_CALLID_IE LIJId;
} Q2931_ADD_PVC, *PQ2931_ADD_PVC;
//
// These flags are defined to be used with Q2931_ADD_PVC above
//
// this VC should be used by the CallMgr as the signaling VC now
#define CO_FLAG_SIGNALING_VC 0x00000001
//
// Use this flag for a PVC that cannot be used for a MakeCall - incoming call only
// the call mgr can then be optimized not to search these PVCs during make call
// processing.
#define CO_FLAG_NO_DEST_SAP 0x00000002
//
// Use this flag for a PVC that cannot be used to indicate an incoming call.
//
#define CO_FLAG_NO_LOCAL_SAP 0x00000004
//
// the structure passed in the Parameters field of the CO_SPECIFIC_PARAMETERS
// structure passed in an NDIS_CO_PVC request for Q2931
//
typedef struct _Q2931_DELETE_PVC
{
ATM_VPIVCI ConnectionId;
} Q2931_DELETE_PVC, *PQ2931_DELETE_PVC;
typedef struct _CO_GET_CALL_INFORMATION
{
ULONG CallInfoType;
ULONG CallInfoLength;
PVOID CallInfoBuffer;
} CO_GET_CALL_INFORMATION, *PCO_GET_CALL_INFORMATION;
//
// the structure for returning the supported VC rates from the miniport,
// returned in response to OID_ATM_SUPPORTED_VC_RATES
//
typedef struct _ATM_VC_RATES_SUPPORTED
{
ULONG MinCellRate;
ULONG MaxCellRate;
} ATM_VC_RATES_SUPPORTED, *PATM_VC_RATES_SUPPORTED;
//
// NDIS_PACKET out of band information for ATM.
//
typedef struct _ATM_AAL_OOB_INFO
{
ATM_AAL_TYPE AalType;
union
{
struct _ATM_AAL5_INFO
{
BOOLEAN CellLossPriority;
UCHAR UserToUserIndication;
UCHAR CommonPartIndicator;
} ATM_AAL5_INFO;
struct _ATM_AAL0_INFO
{
BOOLEAN CellLossPriority;
UCHAR PayLoadTypeIdentifier;
} ATM_AAL0_INFO;
};
} ATM_AAL_OOB_INFO, *PATM_AAL_OOB_INFO;
//
// Physical Line Speeds in bits/sec.
//
#define ATM_PHYS_RATE_SONET_STS3C 155520000
#define ATM_PHYS_RATE_IBM_25 25600000
//
// ATM cell layer transfer capacities in bits/sec. This is the throughput
// available for ATM cells, after allowing for physical framing overhead.
//
#define ATM_CELL_TRANSFER_CAPACITY_SONET_STS3C 149760000
#define ATM_CELL_TRANSFER_CAPACITY_IBM_25 25125926
//
// User data rate in units of 100 bits/sec. This is returned in response to
// the OID_GEN_CO_LINK_SPEED query. This is the effective rate of
// transfer of data available to the ATM layer user, after allowing for
// the ATM cell header.
//
#define ATM_USER_DATA_RATE_SONET_155 1356317
#define ATM_USER_DATA_RATE_IBM_25 227556
//
// The ATM Service Registry MIB Table is used to locate ATM network
// services. OID_ATM_GET_SERVICE_ADDRESS is used by clients to access
// this table.
//
typedef ULONG ATM_SERVICE_REGISTRY_TYPE;
#define ATM_SERVICE_REGISTRY_LECS 1 // LAN Emulation Configuration Server
#define ATM_SERVICE_REGISTRY_ANS 2 // ATM Name Server
//
// Structure passed to OID_ATM_GET_SERVICE_ADDRESS.
//
typedef struct _ATM_SERVICE_ADDRESS_LIST
{
ATM_SERVICE_REGISTRY_TYPE ServiceRegistryType;
ULONG NumberOfAddressesAvailable;
ULONG NumberOfAddressesReturned;
ATM_ADDRESS Address[1];
} ATM_SERVICE_ADDRESS_LIST, *PATM_SERVICE_ADDRESS_LIST;
#endif // _ATM_H_

View File

@ -0,0 +1,104 @@
/*++
Copyright (c) 2004 Microsoft Corporation
Module Name:
aux_klib.h
Abstract:
Kernel mode shim to access system functionality that is not properly exposed
to applications in currently shipping operating systems.
--*/
#ifndef _AUX_KLIB_H
#define _AUX_KLIB_H
#ifndef PIMAGE_EXPORT_DIRECTORY
#include <ntimage.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if (NTDDI_VERSION >= NTDDI_WIN2K)
#define AUX_KLIB_MODULE_PATH_LEN 256
typedef struct _AUX_MODULE_BASIC_INFO {
PVOID ImageBase;
} AUX_MODULE_BASIC_INFO, *PAUX_MODULE_BASIC_INFO;
typedef struct _AUX_MODULE_EXTENDED_INFO {
AUX_MODULE_BASIC_INFO BasicInfo;
ULONG ImageSize;
USHORT FileNameOffset;
UCHAR FullPathName [AUX_KLIB_MODULE_PATH_LEN];
} AUX_MODULE_EXTENDED_INFO, *PAUX_MODULE_EXTENDED_INFO;
typedef struct _KBUGCHECK_DATA {
ULONG BugCheckDataSize;
ULONG BugCheckCode;
ULONG_PTR Parameter1;
ULONG_PTR Parameter2;
ULONG_PTR Parameter3;
ULONG_PTR Parameter4;
} KBUGCHECK_DATA, *PKBUGCHECK_DATA;
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
#if (NTDDI_VERSION >= NTDDI_WIN2K)
NTSTATUS
__stdcall
AuxKlibInitialize (
VOID
);
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
#if (NTDDI_VERSION >= NTDDI_WIN2K)
NTSTATUS
__stdcall
AuxKlibQueryModuleInformation (
IN OUT PULONG BufferSize,
IN ULONG ElementSize,
OUT PVOID QueryInfo OPTIONAL
);
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
#if (NTDDI_VERSION >= NTDDI_WIN2K)
NTSTATUS
AuxKlibGetBugCheckData(
OUT PKBUGCHECK_DATA BugCheckData
);
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
#if (NTDDI_VERSION >= NTDDI_WIN2K)
PIMAGE_EXPORT_DIRECTORY
AuxKlibGetImageExportDirectory(
IN PVOID ImageBase
);
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
#ifdef __cplusplus
}
#endif
#endif // _AUX_KLIB_H

View File

@ -0,0 +1,397 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
avc.h
Abstract
MS AVC Driver
Author:
PB 9/24/99
Revision History:
Date Who What
-------- --------- ------------------------------------------------------------
9/24/99 PB created
10/13/99 DG added avc protocol support
--*/
#if (NTDDI_VERSION >= NTDDI_WINXP)
#ifndef _AVC_H_
#define _AVC_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef CTL_CODE
#pragma message ("CTL_CODE undefined. Include winioctl.h or wdm.h")
#endif
// ctype values from AVC Digital Interface General Specification, Rev 3.0, Section 5.3.1
typedef enum _tagAvcCommandType {
AVC_CTYPE_CONTROL = 0x00,
AVC_CTYPE_STATUS = 0x01,
AVC_CTYPE_SPEC_INQ = 0x02,
AVC_CTYPE_NOTIFY = 0x03,
AVC_CTYPE_GEN_INQ = 0x04
} AvcCommandType;
// response values from AVC Digital Interface General Specification, Rev 3.0, Section 5.3.2
typedef enum _tagAvcResponseCode {
AVC_RESPONSE_NOTIMPL = 0x08,
AVC_RESPONSE_ACCEPTED = 0x09,
AVC_RESPONSE_REJECTED = 0x0a,
AVC_RESPONSE_IN_TRANSITION = 0x0b,
AVC_RESPONSE_STABLE = 0x0c,
AVC_RESPONSE_IMPLEMENTED = 0x0c,
AVC_RESPONSE_CHANGED = 0x0d,
AVC_RESPONSE_INTERIM = 0x0f
} AvcResponseCode;
// subunit type values from Enhancements to AV/C General Specification 3.0, Version 1.1, Section 7.
typedef enum _tagAvcSubunitType {
AVC_SUBUNITTYPE_VIDEO_MONITOR = 0x00,
AVC_SUBUNITTYPE_AUDIO = 0x01,
AVC_SUBUNITTYPE_PRINTER = 0x02,
AVC_SUBUNITTYPE_DISC_PLAYER = 0x03,
AVC_SUBUNITTYPE_TAPE_PLAYER = 0x04,
AVC_SUBUNITTYPE_TUNER = 0x05,
AVC_SUBUNITTYPE_CA = 0x06,
AVC_SUBUNITTYPE_VIDEO_CAMERA = 0x07,
AVC_SUBUNITTYPE_PANEL = 0x09,
AVC_SUBUNITTYPE_BULLETINBOARD = 0x0A,
AVC_SUBUNITTYPE_CAMERASTORAGE = 0x0B,
AVC_SUBUNITTYPE_VENDOR_UNIQUE = 0x1c,
AVC_SUBUNITTYPE_EXTENDED = 0x1e,
AVC_SUBUNITTYPE_EXTENDED_FULL = 0xff, // This is used only in extension bytes
AVC_SUBUNITTYPE_UNIT = 0x1f
} AvcSubunitType;
#ifdef _NTDDK_
#define STATIC_KSMEDIUMSETID_1394SerialBus\
0x9D46279FL, 0x3432, 0x48F3, 0x88, 0x8A, 0xEE, 0xFF, 0x1B, 0x7E, 0xEE, 0x71
DEFINE_GUIDSTRUCT("9D46279F-3432-48F3-888A-EEFF1B7EEE71", KSMEDIUMSETID_1394SerialBus);
#define KSMEDIUMSETID_1394SerialBus DEFINE_GUIDNAMED(KSMEDIUMSETID_1394SerialBus)
#define DEFAULT_AVC_TIMEOUT (1000000L) // 100ms in 100 nanosecond units
#define DEFAULT_AVC_RETRIES 9 // 10 tries altogether
// Max pages available via the SUBUNIT INFO command
#define MAX_AVC_SUBUNITINFO_PAGES 8
// Max number of bytes of subunit address information per page
#define MAX_AVC_SUBUNITINFO_BYTES 4
// Combined subunit address byte count for all pages
#define AVC_SUBUNITINFO_BYTES (MAX_AVC_SUBUNITINFO_PAGES * MAX_AVC_SUBUNITINFO_BYTES)
//
// IOCTL definitions
//
#define IOCTL_AVC_CLASS CTL_CODE( \
FILE_DEVICE_UNKNOWN, \
0x92, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS \
)
typedef enum _tagAVC_FUNCTION {
AVC_FUNCTION_COMMAND = 0, // struct AVC_COMMAND_IRB
AVC_FUNCTION_GET_PIN_COUNT = 1, // struct AVC_PIN_COUNT
AVC_FUNCTION_GET_PIN_DESCRIPTOR = 2, // struct AVC_PIN_DESCRIPTOR
AVC_FUNCTION_GET_CONNECTINFO = 3, // struct AVC_PRECONNECT_INFO
AVC_FUNCTION_SET_CONNECTINFO = 4, // struct AVC_SETCONNECT_INFO
AVC_FUNCTION_ACQUIRE = 5, // struct AVC_PIN_ID
AVC_FUNCTION_RELEASE = 6, // struct AVC_PIN_ID
AVC_FUNCTION_CLR_CONNECTINFO = 7, // struct AVC_PIN_ID
AVC_FUNCTION_GET_EXT_PLUG_COUNTS = 8, // struct AVC_EXT_PLUG_COUNTS
AVC_FUNCTION_GET_UNIQUE_ID = 9, // struct AVC_UNIQUE_ID
AVC_FUNCTION_GET_REQUEST = 10, // struct AVC_COMMAND_IRB
AVC_FUNCTION_SEND_RESPONSE = 11, // struct AVC_COMMAND_IRB
AVC_FUNCTION_FIND_PEER_DO = 12, // struct AVC_PEER_DO_LOCATOR
AVC_FUNCTION_PEER_DO_LIST = 13, // struct AVC_PEER_DO_LIST
AVC_FUNCTION_GET_SUBUNIT_INFO = 14, // struct AVC_SUBUNIT_INFO_BLOCK
} AVC_FUNCTION;
// Ensure that packing is consistent (/Zp8)
#include <pshpack8.h>
// This structure is to be included at the head of a more specific AVC function structure
typedef struct _AVC_IRB {
AVC_FUNCTION Function;
} AVC_IRB, *PAVC_IRB;
// The maximum number of bytes available for an operand list
#define MAX_AVC_OPERAND_BYTES 509
// AVC_COMMAND_IRB
//
// This structure defines the common components of an AVC command request. It
// holds the opcode and operands of a request, and the opcode and operands
// of a response (upon completion). The size of the operand list is fixed at
// the maximum allowable number of operands given a one-byte Subunit Address.
// If the Subunit Address is extended in any way, the maximum permissible
// number of operand bytes will be reduced accordingly.
// (supported by peer and virtual instances)
typedef struct _AVC_COMMAND_IRB {
// AVC_FUNCTION_COMMAND
#ifdef __cplusplus
AVC_IRB Common;
#else
AVC_IRB;
#endif
UCHAR SubunitAddrFlag : 1; // set to 1 if a SubunitAddr address is specified
UCHAR AlternateOpcodesFlag : 1; // set to 1 if the AlternateOpcodes address is specified
UCHAR TimeoutFlag : 1; // set to 1 if Timeout specified
UCHAR RetryFlag : 1; // set to 1 if Retries specified
// On command request, this struct will use the CommandType
// On command response, this struct will use ResponseCode
union {
UCHAR CommandType;
UCHAR ResponseCode;
};
PUCHAR SubunitAddr; // set according to the target device object if not specified
PUCHAR AlternateOpcodes; // set to the address of an array of alternate opcodes (byte 0
// is the count of alternate opcodes that follow)
LARGE_INTEGER Timeout; // Defaults to DEFAULT_AVC_TIMEOUT if not specified
UCHAR Retries; // Defaults to DEFAULT_AVC_RETRIES if not specified
// The total amount of time a request will wait if the subunit is not responsive is:
// Timeout * (Retries+1)
UCHAR Opcode;
ULONG OperandLength; // set to the actual length of the operand list
UCHAR Operands[MAX_AVC_OPERAND_BYTES];
NODE_ADDRESS NodeAddress; // Used by virtual devices, ignored otherwise
ULONG Generation; // Used by virtual devices, ignored otherwise
} AVC_COMMAND_IRB, *PAVC_COMMAND_IRB;
// For AVC_FUNCTION_GET_PIN_COUNT (supported by peer instance only)
//
typedef struct _AVC_PIN_COUNT {
ULONG PinCount; // The pin count
} AVC_PIN_COUNT, *PAVC_PIN_COUNT;
// Dataformat Intersection handler used in struct AVC_PIN_DESCRIPTOR
typedef
__checkReturn
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
(*PFNAVCINTERSECTHANDLER)(
__in PVOID Context,
__in ULONG PinId,
__in PKSDATARANGE DataRange,
__in PKSDATARANGE MatchingDataRange,
__in ULONG DataBufferSize,
__out_bcount_opt(DataBufferSize) PVOID Data,
__out PULONG DataSize
);
// For AVC_FUNCTION_GET_PIN_DESCRIPTOR (supported by peer instance only)
//
typedef struct _AVC_PIN_DESCRIPTOR {
ULONG PinId; // The pin number
KSPIN_DESCRIPTOR PinDescriptor;
PFNAVCINTERSECTHANDLER IntersectHandler;
PVOID Context;
} AVC_PIN_DESCRIPTOR, *PAVC_PIN_DESCRIPTOR;
#define AVCCONNECTINFO_MAX_SUBUNITADDR_LEN AVC_SUBUNITINFO_BYTES
typedef enum _KSPIN_FLAG_AVC {
KSPIN_FLAG_AVCMASK = 0x03, // the mask to isolate the AV/C defined bit flags
KSPIN_FLAG_AVC_PERMANENT = 0x01, // part of the AV/C Connect Status bit flag
KSPIN_FLAG_AVC_CONNECTED = 0x02, // part of the AV/C Connect Status bit flag
KSPIN_FLAG_AVC_PCRONLY = 0x04, // no subunit plug control
KSPIN_FLAG_AVC_FIXEDPCR = 0x08, // implies KSPIN_FLAG_AVC_PERMANENT
} KSPIN_FLAG_AVC;
typedef struct _AVCPRECONNECTINFO {
// Unique ID of the target unit
GUID DeviceID;
UCHAR SubunitAddress[AVCCONNECTINFO_MAX_SUBUNITADDR_LEN];
ULONG SubunitPlugNumber;
KSPIN_DATAFLOW DataFlow;
// KSPIN_FLAG_AVC_...
ULONG Flags;
// Undefined if !(Flags & KSPIN_FLAG_AVC_FIXEDPCR)
ULONG UnitPlugNumber;
} AVCPRECONNECTINFO, *PAVCPRECONNECTINFO;
// For AVC_FUNCTION_GET_CONNECTINFO (supported by peer instance only)
//
typedef struct _AVC_PRECONNECT_INFO {
ULONG PinId; // The pin number
AVCPRECONNECTINFO ConnectInfo;
} AVC_PRECONNECT_INFO, *PAVC_PRECONNECT_INFO;
typedef struct _AVCCONNECTINFO {
// Unique ID of the target unit
GUID DeviceID;
UCHAR SubunitAddress[AVCCONNECTINFO_MAX_SUBUNITADDR_LEN];
ULONG SubunitPlugNumber;
KSPIN_DATAFLOW DataFlow;
// NULL if intra-unit connection
HANDLE hPlug;
// Undefined if hPlug == NULL
ULONG UnitPlugNumber;
} AVCCONNECTINFO, *PAVCCONNECTINFO;
// For AVC_FUNCTION_SET_CONNECTINFO (supported by peer instance only)
//
typedef struct _AVC_SETCONNECT_INFO {
ULONG PinId; // The pin number
AVCCONNECTINFO ConnectInfo;
} AVC_SETCONNECT_INFO, *PAVC_SETCONNECT_INFO;
// For AVC_FUNCTION_ACQUIRE or AVC_FUNCTION_RELEASE or AVC_FUNCTION_CLR_CONNECTINFO (supported by peer instance only)
//
typedef struct _AVC_PIN_ID {
ULONG PinId; // The pin ID
} AVC_PIN_ID, *PAVC_PIN_ID;
// For AVC_FUNCTION_GET_EXT_PLUG_COUNTS (supported by peer instance only)
//
typedef struct _AVC_EXT_PLUG_COUNTS {
ULONG ExtInputs;
ULONG ExtOutputs;
} AVC_EXT_PLUG_COUNTS, *PAVC_EXT_PLUG_COUNTS;
// For AVC_FUNCTION_GET_UNIQUE_ID (supported by peer instance only)
//
typedef struct _AVC_UNIQUE_ID {
// Unique ID of the target unit
GUID DeviceID;
} AVC_UNIQUE_ID, *PAVC_UNIQUE_ID;
// For AVC_FUNCTION_FIND_PEER_DO
//
typedef struct _AVC_PEER_DO_LOCATOR {
// 1394 NodeAddress identifying target for query
NODE_ADDRESS NodeAddress;
ULONG Generation;
PDEVICE_OBJECT DeviceObject;
} AVC_PEER_DO_LOCATOR, *PAVC_PEER_DO_LOCATOR;
// For AVC_FUNCTION_PEER_DO_LIST
//
typedef struct _AVC_PEER_DO_LIST {
// Counted array of referenced device objects (allocated by target)
ULONG Count;
__field_ecount(Count)
PDEVICE_OBJECT *Objects;
} AVC_PEER_DO_LIST, *PAVC_PEER_DO_LIST;
// For AVC_FUNCTION_GET_SUBUNIT_INFO
//
typedef struct _AVC_SUBUNIT_INFO_BLOCK {
// Array of bytes to hold subunit info (see AV/C SUBUNIT_INFO unit command for format)
UCHAR Info[AVC_SUBUNITINFO_BYTES];
} AVC_SUBUNIT_INFO_BLOCK, *PAVC_SUBUNIT_INFO_BLOCK;
typedef struct _AVC_MULTIFUNC_IRB {
#ifdef __cplusplus
AVC_IRB Common;
#else
AVC_IRB;
#endif
union {
AVC_PIN_COUNT PinCount; // AVC_FUNCTION_GET_PIN_COUNT
AVC_PIN_DESCRIPTOR PinDescriptor; // AVC_FUNCTION_GET_PIN_DESCRIPTOR
AVC_PRECONNECT_INFO PreConnectInfo; // AVC_FUNCTION_GET_CONNECTINFO
AVC_SETCONNECT_INFO SetConnectInfo; // AVC_FUNCTION_SET_CONNECTINFO
AVC_PIN_ID PinId; // AVC_FUNCTION_ACQUIRE or
// AVC_FUNCTION_RELEASE or
// AVC_FUNCTION_CLR_CONNECTINFO
AVC_EXT_PLUG_COUNTS ExtPlugCounts; // AVC_FUNCTION_GET_EXT_PLUG_COUNTS
AVC_UNIQUE_ID UniqueID; // AVC_FUNCTION_GET_UNIQUE_ID
AVC_PEER_DO_LOCATOR PeerLocator; // AVC_FUNCTION_FIND_PEER_DO
AVC_PEER_DO_LIST PeerList; // AVC_FUNCTION_PEER_DO_LIST
AVC_SUBUNIT_INFO_BLOCK Subunits; // AVC_FUNCTION_GET_SUBUNIT_INFO
};
} AVC_MULTIFUNC_IRB, *PAVC_MULTIFUNC_IRB;
#include <poppack.h>
#endif // _NTDDK_
//
// IOCTL definitions for Virtual Unit control (from user mode)
//
#define IOCTL_AVC_UPDATE_VIRTUAL_SUBUNIT_INFO CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x000, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AVC_REMOVE_VIRTUAL_SUBUNIT_INFO CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x001, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AVC_BUS_RESET CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x002, METHOD_BUFFERED, FILE_ANY_ACCESS)
// Ensure that packing is consistent (/Zp8)
#include <pshpack8.h>
typedef struct _AVC_SUBUNIT_ADDR_SPEC {
ULONG Flags;
UCHAR SubunitAddress[1];
} AVC_SUBUNIT_ADDR_SPEC, *PAVC_SUBUNIT_ADDR_SPEC;
// Flags, when used with IOCTL_AVC_UPDATE_VIRTUAL_SUBUNIT_INFO
// and IOCTL_AVC_REMOVE_VIRTUAL_SUBUNIT_INFO
#define AVC_SUBUNIT_ADDR_PERSISTENT 0x00000001
#define AVC_SUBUNIT_ADDR_TRIGGERBUSRESET 0x00000002
#include <poppack.h>
#ifdef __cplusplus
}
#endif
#endif // _AVC_H_
#ifndef AVC_GUIDS_DEFINED
#define AVC_GUIDS_DEFINED
// {616EF4D0-23CE-446d-A568-C31EB01913D0}
DEFINE_GUID(GUID_VIRTUAL_AVC_CLASS, 0x616ef4d0, 0x23ce, 0x446d, 0xa5, 0x68, 0xc3, 0x1e, 0xb0, 0x19, 0x13, 0xd0);
// {095780C3-48A1-4570-BD95-46707F78C2DC}
DEFINE_GUID(GUID_AVC_CLASS, 0x095780c3, 0x48a1, 0x4570, 0xbd, 0x95, 0x46, 0x70, 0x7f, 0x78, 0xc2, 0xdc);
#endif
#endif

View File

@ -0,0 +1,551 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
avcstrm.h
Abstract
MS AVC Connection and Streaming
--*/
#if (NTDDI_VERSION >= NTDDI_WINXP)
#ifndef __AVCSTRM_H__
#define __AVCSTRM_H__
#define MASK_AUX_50_60_BIT 0x00200000 // the NTSC/PAL bit of DV{A|V}AuxSrc
// DVINFO
typedef struct _DVINFO {
//for 1st track
DWORD dwDVAAuxSrc;
DWORD dwDVAAuxCtl;
// for 2nd track
DWORD dwDVAAuxSrc1;
DWORD dwDVAAuxCtl1;
//for video information
DWORD dwDVVAuxSrc;
DWORD dwDVVAuxCtl;
DWORD dwDVReserved[2];
} DVINFO, *PDVINFO;
// Static definitions for DVINFO initialization
// MEDIATYPE_Interleaved equivalent
#define STATIC_KSDATAFORMAT_TYPE_INTERLEAVED\
0x73766169L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
DEFINE_GUIDSTRUCT("73766169-0000-0010-8000-00aa00389b71", KSDATAFORMAT_TYPE_INTERLEAVED);
#define KSDATAFORMAT_TYPE_INTERLEAVED DEFINE_GUIDNAMED(KSDATAFORMAT_TYPE_INTERLEAVED)
// MEDIASUBTYPE_dvsd equivalent
#define STATIC_KSDATAFORMAT_SUBTYPE_DVSD\
0x64737664L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
DEFINE_GUIDSTRUCT("64737664-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DVSD);
#define KSDATAFORMAT_SUBTYPE_DVSD DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DVSD)
// MEDIASUBTYPE_dvsl equivalent
#define STATIC_KSDATAFORMAT_SUBTYPE_DVSL\
0x6C737664L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
DEFINE_GUIDSTRUCT("6C737664-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DVSL);
#define KSDATAFORMAT_SUBTYPE_DVSL DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DVSL)
// MEDIASUBTYPE_dvhd equivalent
#define STATIC_KSDATAFORMAT_SUBTYPE_DVHD\
0x64687664L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
DEFINE_GUIDSTRUCT("64687664-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DVHD);
#define KSDATAFORMAT_SUBTYPE_DVHD DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DVHD)
#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1)
// MEDIASUBTYPE_dv25 equivalent
#define STATIC_KSDATAFORMAT_SUBTYPE_dv25\
0x35327664L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
DEFINE_GUIDSTRUCT("35327664-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_dv25);
#define KSDATAFORMAT_SUBTYPE_dv25 DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_dv25)
// MEDIASUBTYPE_dv50 equivalent
#define STATIC_KSDATAFORMAT_SUBTYPE_dv50\
0x30357664L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
DEFINE_GUIDSTRUCT("30357664-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_dv50);
#define KSDATAFORMAT_SUBTYPE_dv50 DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_dv50)
// MEDIASUBTYPE_dvh1 equivalent
#define STATIC_KSDATAFORMAT_SUBTYPE_dvh1\
0x31687664L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
DEFINE_GUIDSTRUCT("31687664-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_dvh1);
#define KSDATAFORMAT_SUBTYPE_dvh1 DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_dvh1)
#endif
// FORMAT_DvInfo equivalent
#define STATIC_KSDATAFORMAT_SPECIFIER_DVINFO\
0x05589f84L, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a
DEFINE_GUIDSTRUCT("05589f84-c356-11ce-bf01-00aa0055595a", KSDATAFORMAT_SPECIFIER_DVINFO);
#define KSDATAFORMAT_SPECIFIER_DVINFO DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_DVINFO)
#define STATIC_KSDATAFORMAT_SPECIFIER_DV_AVC\
0xddcff71aL, 0xfc9f, 0x4bd9, 0xb9, 0xb, 0x19, 0x7b, 0xd, 0x44, 0xad, 0x94
DEFINE_GUIDSTRUCT("ddcff71a-fc9f-4bd9-b90b-197b0d44ad94", KSDATAFORMAT_SPECIFIER_DV_AVC);
#define KSDATAFORMAT_SPECIFIER_DV_AVC DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_DV_AVC)
#define STATIC_KSDATAFORMAT_SPECIFIER_AVC\
0xf09dc377L, 0x6e51, 0x4ec5, 0xa0, 0xc4, 0xcd, 0x7f, 0x39, 0x62, 0x98, 0x80
DEFINE_GUIDSTRUCT("f09dc377-6e51-4ec5-a0c4-cd7f39629880", KSDATAFORMAT_SPECIFIER_AVC);
#define KSDATAFORMAT_SPECIFIER_AVC DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_AVC)
// Media subtype for MPEG2TS with STRIDE
#define STATIC_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT_STRIDE\
0x138aa9a4L, 0x1ee2, 0x4c5b, 0x98, 0x8e, 0x19, 0xab, 0xfd, 0xbc, 0x8a, 0x11
DEFINE_GUIDSTRUCT("138aa9a4-1ee2-4c5b-988e-19abfdbc8a11", KSDATAFORMAT_TYPE_MPEG2_TRANSPORT_STRIDE);
#define KSDATAFORMAT_TYPE_MPEG2_TRANSPORT_STRIDE DEFINE_GUIDNAMED(KSDATAFORMAT_TYPE_MPEG2_TRANSPORT_STRIDE)
// Specifier for MPEG2TS with STRIDE
#define STATIC_KSDATAFORMAT_SPECIFIER_61883_4\
0x97e218b1L, 0x1e5a, 0x498e, 0xa9, 0x54, 0xf9, 0x62, 0xcf, 0xd9, 0x8c, 0xde
DEFINE_GUIDSTRUCT("97e218b1-1e5a-498e-a954-f962cfd98cde", KSDATAFORMAT_SPECIFIER_61883_4);
#define KSDATAFORMAT_SPECIFIER_61883_4 DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_61883_4)
// Associated with KSDATAFORMAT_SPECIFIER_DVINFO
typedef struct tagKS_DATARANGE_DVVIDEO {
KSDATARANGE DataRange;
DVINFO DVVideoInfo;
} KS_DATARANGE_DVVIDEO, *PKS_DATARANGE_DVVIDEO;
// Associated with KSDATAFORMAT_SPECIFIER_DV_AVC
typedef struct tagKS_DATARANGE_DV_AVC {
KSDATARANGE DataRange;
DVINFO DVVideoInfo;
AVCPRECONNECTINFO ConnectInfo;
} KS_DATARANGE_DV_AVC, *PKS_DATARANGE_DV_AVC;
typedef struct tagKS_DATAFORMAT_DV_AVC {
KSDATAFORMAT DataFormat;
DVINFO DVVideoInfo;
AVCCONNECTINFO ConnectInfo;
} KS_DATAFORMAT_DV_AVC, *PKS_DATAFORMAT_DV_AVC;
// Associated with KSDATAFORMAT_SPECIFIER_AVC
typedef struct tagKS_DATARANGE_MPEG2TS_AVC {
KSDATARANGE DataRange;
AVCPRECONNECTINFO ConnectInfo;
} KS_DATARANGE_MPEG2TS_AVC, *PKS_DATARANGE_MPEG2TS_AVC;
typedef struct tagKS_DATAFORMAT_MPEG2TS_AVC {
KSDATAFORMAT DataFormat;
AVCCONNECTINFO ConnectInfo;
} KS_DATAFORMAT_MPEG2TS_AVC, *PKS_DATAFORMAT_MPEG2TS_AVC;
/**********************
// 1394
***********************/
#define SPEED_100_INDEX 0
#define SPEED_200_INDEX 1
#define SPEED_400_INDEX 2
/**********************
// 61883
***********************/
#define BLOCK_PERIOD_2997 133466800 // nano-sec
#define BLOCK_PERIOD_25 133333333 // nano-sec
/************************
// CIP header definition:
*************************/
// FMT: "Blue book" Part 1, page 25, Table 3; DVCR:000000
#define CIP_HDR_FMT_MASK 0x3f
#define CIP_HDR_FMT_DVCR 0x80 // 10:FMT(00:0000)
#define CIP_HDR_FMT_MPEG 0xa0 // 10:FMT(10:0000)
// FDF
#define CIP_HDR_FDF0_50_60_MASK 0x80
#define CIP_HDR_FDF0_50_60_PAL 0x80
#define CIP_HDR_FDF0_50_60_NTSC 0x00
#define CIP_HDR_FDF0_STYPE_MASK 0x7c
#define CIP_HDR_FDF0_STYPE_SD_DVCR 0x00 // STYPE: 000:00
#define CIP_HDR_FDF0_STYPE_SDL_DVCR 0x04 // STYPE: 000:01
#define CIP_HDR_FDF0_STYPE_HD_DVCR 0x08 // STYPE: 000:10
#define CIP_HDR_FDF0_STYPE_SD_DVCPRO 0x78 // STYPE: 111:10
#define CIP_SPH_DV 0 // No source packet header
#define CIP_SPH_MPEG 1 // Has a source packet header
#define CIP_FN_DV 0 // Data blocks in a source pacaket of SD DVCR; BlueBook Part 2
#define CIP_FN_MPEG 0x3 // Data blocks in a source pacaket of SD DVCR; BlueBook Part 2
#define CIP_QPC_DV 0 // No padding
#define CIP_QPC_MPEG 0 // No padding
#define CIP_SPH_DV 0 // No header
#define CIP_SPH_MPEG 1 // Has a header (time stamp)
#define CIP_DBS_SDDV 120 // quadlets in a data block of the SD DVCR; BlueBook Part 2
#define CIP_DBS_HDDV 240 // quadlets in a data block of the HD DVCR; BlueBook Part 3
#define CIP_DBS_SDLDV 60 // quadlets in a data block of the SDL DVCR; BlueBook Part 5
#define CIP_DBS_MPEG 6 // quadlets in a data block of the MPEG TS; BlueBook Part 4
#define CIP_FMT_DV 0x0 // 00 0000
#define CIP_FMT_MPEG 0x20 // 10 0000
#define CIP_60_FIELDS 0 // 60 fields (NTSC)
#define CIP_50_FIELDS 1 // 50 fields (PAL)
#define CIP_TSF_ON 1 // TimeShift is ON
#define CIP_TSF_OFF 0 // TimeShift is OFF
#define CIP_STYPE_DV 0x0 // 00000
#define CIP_STYPE_DVCPRO 0x1e // 11100
//
// Some derive values
//
#define SRC_PACKETS_PER_NTSC_FRAME 250 // Fixed and same for SDDV, HDDV and SDLDV
#define SRC_PACKETS_PER_PAL_FRAME 300 // Fixed and same for SDDV, HDDV and SDLDV
// Note: Frame size of MPEG2 will depends on number of source packets per frame, and
// the is application dependent..
#define FRAME_TIME_NTSC 333667 // "about" 29.97
#define FRAME_TIME_PAL 400000 // exactly 25
#define SRC_PACKET_SIZE_SDDV ((CIP_DBS_SDDV << 2) * (1 << CIP_FN_DV))
#define SRC_PACKET_SIZE_HDDV ((CIP_DBS_HDDV << 2) * (1 << CIP_FN_DV))
#define SRC_PACKET_SIZE_SDLDV ((CIP_DBS_SDLDV << 2) * (1 << CIP_FN_DV))
#define SRC_PACKET_SIZE_MPEG2TS ((CIP_DBS_MPEG << 2) * (1 << CIP_FN_MPEG)) // Contain a sourcr packet header
#define FRAME_SIZE_SDDV_NTSC (SRC_PACKET_SIZE_SDDV * SRC_PACKETS_PER_NTSC_FRAME)
#define FRAME_SIZE_SDDV_PAL (SRC_PACKET_SIZE_SDDV * SRC_PACKETS_PER_PAL_FRAME)
#define FRAME_SIZE_HDDV_NTSC (SRC_PACKET_SIZE_HDDV * SRC_PACKETS_PER_NTSC_FRAME)
#define FRAME_SIZE_HDDV_PAL (SRC_PACKET_SIZE_HDDV * SRC_PACKETS_PER_PAL_FRAME)
#define FRAME_SIZE_SDLDV_NTSC (SRC_PACKET_SIZE_SDLDV * SRC_PACKETS_PER_NTSC_FRAME)
#define FRAME_SIZE_SDLDV_PAL (SRC_PACKET_SIZE_SDLDV * SRC_PACKETS_PER_PAL_FRAME)
// Generic 1st quadlet of a CIP header
typedef struct _CIP_HDR1 {
ULONG DBC: 8; // Continuity counter of data blocks
ULONG Rsv00: 2;
ULONG SPH: 1; // Sourcre packet header; 1: source packet contain a source packet header
ULONG QPC: 3; // Quadlet padding count (0..7 quadlets)
ULONG FN: 2; // Fraction number
ULONG DBS: 8; // Data block size in quadlets
ULONG SID: 6; // Source node ID (ID of transmitter)
ULONG Bit00: 2; // Always 0:0
} CIP_HDR1, *PCIP_HDR1;
// Generic 2nd quadlet of a CIP header with SYT field
typedef struct _CIP_HDR2_SYT {
ULONG SYT: 16; // lower 16bits of IEEE CYCLE_TIME
ULONG RSV: 2; //
ULONG STYPE: 5; // Signal type of video signal
ULONG F5060_OR_TSF: 1; // 0:(60 field system; NTSC); 1:(50 field system; PAL); or 1/0 for TimeShiftFlag
// e.g. 000000:DV, 100000 :MPEGTS;
// if 111111 (no data), DBS, FN, QPC, SPH and DBC arfe ignored.
ULONG FMT: 6; // Format ID
ULONG Bit10: 2; // Always 1:0
} CIP_HDR2_SYT, *PCIP_HDR2_SYT;
// Generic 2nd quadlet of a CIP header with FDF field
typedef struct _CIP_HDR2_FDF {
ULONG FDF: 24;
ULONG FMT: 6; // e.g. 000000:DV, 100000 :MPEGTS
ULONG Bit10: 2; // Always 1:0
} CIP_HDR2_FDF, *PCIP_HDR2_FDF;
// 2nd quadlet of a CIP header of a MPEGTS data
typedef struct _CIP_HDR2_MPEGTS {
ULONG TSF: 1;
ULONG RSV23bit: 23;
ULONG FMT: 6; // e.g. 000000:DV, 100000 :MPEGTS
ULONG Bit10: 2; // Always 1:0
} CIP_HDR2_MPEGTS, *PCIP_HDR2_MPEGTS;
//
// AV/C command response data definition
//
#define AVC_DEVICE_TAPE_REC 0x20 // 00100:000
#define AVC_DEVICE_CAMERA 0x38 // 00111:000
#define AVC_DEVICE_TUNER 0x28 // 00101:000
//
// 61883 data format
//
typedef enum _AVCSTRM_FORMAT {
AVCSTRM_FORMAT_SDDV_NTSC = 0, // 61883-2
AVCSTRM_FORMAT_SDDV_PAL, // 61883-2
AVCSTRM_FORMAT_MPEG2TS, // 61883-4
AVCSTRM_FORMAT_HDDV_NTSC, // 61883-3
AVCSTRM_FORMAT_HDDV_PAL, // 61883-3
AVCSTRM_FORMAT_SDLDV_NTSC, // 61883-5
AVCSTRM_FORMAT_SDLDV_PAL, // 61883-5
// others..
} AVCSTRM_FORMAT;
//
// This structure is create and initialize by the subunit.parameters
// The streaming DLL will streaming based on these parameters.
// Not all parameters apply to every format.
//
#define AVCSTRM_FORMAT_OPTION_STRIP_SPH 0x00000001
typedef struct _AVCSTRM_FORMAT_INFO {
ULONG SizeOfThisBlock; // sizeof of this structure
/**************************
* 61883-x format defintion
**************************/
AVCSTRM_FORMAT AVCStrmFormat; // Format, such as DV or MPEG2TS
//
// Two quadlet of a CIP header
//
CIP_HDR1 cipHdr1;
CIP_HDR2_SYT cipHdr2;
/*****************
* Buffers related
*****************/
//
// Number of source packet per frame
//
ULONG SrcPacketsPerFrame;
//
// Frame size
//
ULONG FrameSize;
//
// Number of receiving buffers
//
ULONG NumOfRcvBuffers;
//
// Number of transmitting buffers
//
ULONG NumOfXmtBuffers;
//
// Optional flags
//
DWORD OptionFlags;
/********************
* Frame rate related
********************/
//
// Approximate time per frame
//
ULONG AvgTimePerFrame;
//
// BlockPeriod - TX Only
//
ULONG BlockPeriod;
//
// Reserved for future use
//
ULONG Reserved[4];
} AVCSTRM_FORMAT_INFO, * PAVCSTRM_FORMAT_INFO;
//
// IOCTL Definitions
//
#define IOCTL_AVCSTRM_CLASS CTL_CODE( \
FILE_DEVICE_UNKNOWN, \
0x93, \
METHOD_IN_DIRECT, \
FILE_ANY_ACCESS \
)
//
// Current AVCSTRM DDI Version
//
#define CURRENT_AVCSTRM_DDI_VERSION '15TN' // 1.' 8XD' 2.'15TN'
//
// INIT_AVCStrm_HEADER Macro
//
#define INIT_AVCSTRM_HEADER( AVCStrm, Request ) \
(AVCStrm)->SizeOfThisBlock = sizeof(AVC_STREAM_REQUEST_BLOCK); \
(AVCStrm)->Function = Request; \
(AVCStrm)->Version = CURRENT_AVCSTRM_DDI_VERSION;
typedef enum _AVCSTRM_FUNCTION {
// Stream funcrtions
AVCSTRM_READ = 0,
AVCSTRM_WRITE,
AVCSTRM_ABORT_STREAMING, // Cancel all; to cancel each individual IRP, use IoCancelIrp()
AVCSTRM_OPEN = 0x100,
AVCSTRM_CLOSE,
AVCSTRM_GET_STATE,
AVCSTRM_SET_STATE,
// Not enabled
AVCSTRM_GET_PROPERTY,
AVCSTRM_SET_PROPERTY,
} AVCSTRM_FUNCTION;
//
// Structure used to open a stream; a stream extension is returned when success.
//
typedef struct _AVCSTRM_OPEN_STRUCT {
KSPIN_DATAFLOW DataFlow;
PAVCSTRM_FORMAT_INFO AVCFormatInfo;
// return stream exension (a context) if a stream is open successfully
// This context is used for subsequent call after a stream is opened.
PVOID AVCStreamContext;
// Local i/oPCR to be connected to the remote o/iPCR
HANDLE hPlugLocal;
} AVCSTRM_OPEN_STRUCT, * PAVCSTRM_OPEN_STRUCT;
//
// Structure used to read or write a buffer
//
typedef struct _AVCSTRM_BUFFER_STRUCT {
//
// Clock provider
//
BOOL ClockProvider;
HANDLE ClockHandle; // This is used only if !ClockProvider
//
// KS stream header
//
PKSSTREAM_HEADER StreamHeader;
//
// Frame buffer
//
PVOID FrameBuffer;
//
// Notify Context
//
PVOID Context;
} AVCSTRM_BUFFER_STRUCT, * PAVCSTRM_BUFFER_STRUCT;
typedef struct _AVC_STREAM_REQUEST_BLOCK {
ULONG SizeOfThisBlock; // sizeof AVC_STREAM_REQUEST_BLOCK
//
// Version
//
ULONG Version;
//
// AVC Stream function
//
AVCSTRM_FUNCTION Function;
//
// Flags
//
ULONG Flags;
//
// Status of this final AVCStream request.
//
NTSTATUS Status;
//
// This pointer contain the context of a stream and this structure is opaque to client.
//
PVOID AVCStreamContext;
//
// Contexts that the requester needs when this request is completed asychronously
//
PVOID Context1;
PVOID Context2;
PVOID Context3;
PVOID Context4;
ULONG Reserved[4];
//
// the following union passes in the information needed for the various ASRB functions.
//
union _tagCommandData {
// Get or set a stream state
KSSTATE StreamState;
// Struct used to open a stream
AVCSTRM_OPEN_STRUCT OpenStruct;
// Stream buffer structure
AVCSTRM_BUFFER_STRUCT BufferStruct;
} CommandData; // union for function data
} AVC_STREAM_REQUEST_BLOCK, *PAVC_STREAM_REQUEST_BLOCK;
#endif // ifndef __AVCSTRM_H__
#endif

View File

@ -0,0 +1,189 @@
/*++
Copyright (c) 1989 Microsoft Corporation
Module Name:
backpack.h
Abstract:
This module contains the package for pseudo polling. When a caller
requests the same operation and gets the same error return the rdr
must prevent flooding the network by backing off requests. Examples
of when this is desirable are receiving 0 bytes on consequtive reads
and consequtive fails on a file lock.
If the caller is flooding the network, the rdr will return the 0 bytes
or lock fail to the user until NextTime. When NextTime is reached
the network will be used.
Author:
Revision History:
--*/
#ifndef _BACKPACK_
#define _BACKPACK_
typedef struct _THROTTLING_STATE {
LARGE_INTEGER NextTime; // Do not access the network until
// CurrentTime >= NextTime
__volatile ULONG CurrentIncrement; // Number of Increments applied to calculate NextTime
ULONG MaximumDelay; // Specifies slowest rate that we will back off to
// NextTime <= CurrentTime + (Interval * MaximumDelay)
LARGE_INTEGER Increment;// {0,10000000} == 1 second
__volatile ULONG NumberOfQueries;
} THROTTLING_STATE, *PTHROTTLING_STATE;
//++
//
// VOID
// RxInitializeThrottlingState(
// IN PTHROTTLING_STATE pBP,
// IN ULONG Increment,
// IN ULONG MaximumDelay
// );
//
// Routine Description:
//
// This routine is called to initialize the back off structure (usually in
// an Icb).
//
// Arguments:
//
// pBP - Supplies back pack data for this request.
// Increment - Supplies the increase in delay in milliseconds, each time a request
// to the network fails.
// MaximumDelay- Supplies the longest delay the backoff package can introduce
// in milliseconds.
//
// Return Value:
//
// None.
//
//--
#define RxInitializeThrottlingState( _pBP, _Increment, _MaximumDelay ) { \
if ((_Increment)>0) { \
(_pBP)->Increment.QuadPart = (_Increment) * 10000; \
(_pBP)->MaximumDelay = (_MaximumDelay) / (_Increment); \
(_pBP)->CurrentIncrement = 0; \
}}
//++
//
// VOID
// RxUninitializeBackPack(
// IN PTHROTTLING_STATE pBP
// )
//
// Routine Description:
//
// Resets the Back Pack specified. Currently no work needed.
//
// Arguments:
//
// pBP - Supplies back pack address.
//
// Return Value:
//
// None.
//
//--
#define RxUninitializeBackPack( pBP ) ()
// RxShouldRequestBeThrottled indicates when the request should not go to the network.
BOOLEAN
RxShouldRequestBeThrottled(
IN PTHROTTLING_STATE pBP
);
// Register the last request as failed.
VOID
RxInitiateOrContinueThrottling (
IN PTHROTTLING_STATE pBP
);
// Register the last request as worked.
//++
//
// VOID
// RxTerminateThrottling(
// IN PTHROTTLING_STATE pBP
// )
//
// Routine Description:
//
// Sets the Delay to zero. This routine is called each time that
// a network request succeeds to avoid the next request backing off.
//
// Arguments:
//
// pBP - Supplies back pack address.
//
// Return Value:
//
// None.
//
//--
#define RxTerminateThrottling( pBP ) ( (pBP)->CurrentIncrement = 0 )
//++
//
// VOID
// RxInitializeBackoffPackage (
// VOID
// )
//
// Routine Description:
//
// This routine initializes the redirector back off package.
//
// Arguments:
//
// None
//
// Return Value:
//
// None.
//
//--
#define RxInitializeBackoffPackage( )
//++
//
// VOID
// RxUninitializeBackoffPackage (
// VOID
// )
//
// Routine Description:
//
// This routine uninitializes the redirector back off package.
//
// Arguments:
//
// None
//
// Return Value:
//
// None.
//
//--
#define RxUninitializeBackoffPackage( )
#endif /* _BACKPACK_ */

View File

@ -0,0 +1,696 @@
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//==========================================================================;
#if (NTDDI_VERSION >= NTDDI_WINXP)
#if !defined(_BDATYPES_)
#error BDATYPES.H must be included before BDATOPGY.H
#endif // !defined(_BDATYPES_)
#if !defined(_BDATOPGY_)
#define _BDATOPGY_
#if defined(__cplusplus)
extern "C" {
#endif // defined(__cplusplus)
//---------------------------------------------------------------------------
// Common typedefs
//---------------------------------------------------------------------------
#define STDMETHODCALLTYPE __stdcall
typedef GUID * PGUID;
//===========================================================================
//
// BDA KS Topology Structures
//
//===========================================================================
typedef struct _KSM_PIN_PAIR
{
KSMETHOD Method;
ULONG InputPinId;
ULONG OutputPinId;
ULONG Reserved;
} KSM_PIN_PAIR, * PKSM_PIN_PAIR;
typedef struct _KSM_PIN
{
KSMETHOD Method;
union
{
ULONG PinId;
ULONG PinType;
};
ULONG Reserved;
} KSM_PIN, * PKSM_PIN;
typedef ULONG BDA_TOPOLOGY_JOINT, * PBDA_TOPOLOGY_JOINT;
typedef struct _BDA_PIN_PAIRING
{
ULONG ulInputPin;
ULONG ulOutputPin;
ULONG ulcMaxInputsPerOutput;
ULONG ulcMinInputsPerOutput;
ULONG ulcMaxOutputsPerInput;
ULONG ulcMinOutputsPerInput;
ULONG ulcTopologyJoints;
const ULONG * pTopologyJoints;
} BDA_PIN_PAIRING, * PBDA_PIN_PAIRING;
// BDA Topology Template Structures
//
typedef struct _BDA_FILTER_TEMPLATE
{
const KSFILTER_DESCRIPTOR * pFilterDescriptor;
ULONG ulcPinPairs;
const BDA_PIN_PAIRING * pPinPairs;
} BDA_FILTER_TEMPLATE, *PBDA_FILTER_TEMPLATE;
//===========================================================================
//
// BDA Utility Functions
//
//===========================================================================
/*
** BdaCreateFilterFactory()
**
** Creates a Filter Factory according to pFilterDescriptor. Keeps a
** reference to pBdaFilterTemplate so that Pin Factories can be dynamically
** created on a Filter created from this Filter Factory.
**
** Arguments:
**
**
** Returns:
**
**
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaCreateFilterFactory(
__in PKSDEVICE pKSDevice,
__in const KSFILTER_DESCRIPTOR * pFilterDescriptor,
__in const BDA_FILTER_TEMPLATE * pBdaFilterTemplate
);
/*
** BdaCreateFilterFactoryEx()
**
** Creates a Filter Factory according to pFilterDescriptor. Keeps a
** reference to pBdaFilterTemplate so that Pin Factories can be dynamically
** created on a Filter created from this Filter Factory.
**
** Arguments:
**
**
** Returns:
**
**
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaCreateFilterFactoryEx(
__in PKSDEVICE pKSDevice,
__in const KSFILTER_DESCRIPTOR * pFilterDescriptor,
__in const BDA_FILTER_TEMPLATE * pBdaFilterTemplate,
__out_opt PKSFILTERFACTORY * ppKSFilterFactory
);
/*
** BdaInitFilter()
**
** Initializes a BDA filter context for this KS Filter instance. Creates
** a linkage to the BDA Filter Template associated with the factory from
** which this KS Filter instance was created.
**
** Arguments:
**
**
** Returns:
**
**
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaInitFilter(
__in PKSFILTER pKSFilter,
__in const BDA_FILTER_TEMPLATE * pBdaFilterTemplate
);
/*
** BdaUninitFilter()
**
** Unitializes and frees resources from the BDA filter context associated
** with this KS filter instance.
**
** Arguments:
**
**
** Returns:
**
**
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaUninitFilter(
__in PKSFILTER pKSFilter
);
/*
** BdaFilterFactoryUpdateCacheData()
**
** Updates the pin data cache for the given filter factory.
** The function will update the cached information for all pin factories
** exposed by the given filter factory.
**
** If the option filter descriptor is given, the function will update
** the pin data cache for all pins listed in the given filter descriptor
** instead of those in the filter factory.
**
** Drivers will call this to update the pin data cache for all
** pins that may be exposed by the filter factory. The driver will
** provide a filter descriptor listing pins that are not initially exposed
** by the filter factory (this is usually the same as the template filter
** descriptor).
**
** Arguments:
**
**
** Returns:
**
**
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaFilterFactoryUpdateCacheData(
__in PKSFILTERFACTORY pFilterFactory,
__in const KSFILTER_DESCRIPTOR * pFilterDescriptor OPTIONAL
);
/*
** BdaCreatePin()
**
** Utility function creates a new pin in the given filter instance.
**
**
** Arguments:
**
**
** Returns:
**
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaCreatePin(
__in PKSFILTER pKSFilter,
__in ULONG ulPinType,
__out_opt PULONG pulPinId
);
/*
** BdaDeletePin()
**
** Utility function deletes a pin from the given filter instance.
**
**
** Arguments:
**
**
** Returns:
**
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaDeletePin(
__in PKSFILTER pKSFilter,
__out_opt PULONG pulPinId
);
/*
** BdaCreateTopology()
**
** Utility function creates the topology between two pins.
**
**
** Arguments:
**
**
** Returns:
**
** NULL If no valid pin pairing exists with the
** given input and output pins.
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaCreateTopology(
__in PKSFILTER pKSFilter,
__in ULONG InputPinId,
__in ULONG OutputPinId
);
//===========================================================================
//
// BDA Property and Method Functions
//
//===========================================================================
/*
** BdaPropertyNodeTypes ()
**
** Returns a list of ULONGs.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeTypes(
__in PIRP pIrp,
__in PKSPROPERTY pKSProperty,
__out_bcount(OutputBufferLenFromIrp(Irp)) ULONG * pulProperty
);
/*
** BdaPropertyPinTypes ()
**
** Returns a list of GUIDS.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyPinTypes(
__in PIRP pIrp,
__in PKSPROPERTY pKSProperty,
__out_bcount(OutputBufferLenFromIrp(Irp)) ULONG * pulProperty
);
/*
** BdaPropertyTemplateConnections ()
**
** Returns a list of KSTOPOLOGY_CONNECTIONS. The list of connections
** describs how pin types and node types are connected in the template
** topology
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyTemplateConnections(
__in PIRP pIrp,
__in PKSPROPERTY pKSProperty,
__out_opt PKSTOPOLOGY_CONNECTION pConnectionProperty
);
/*
** BdaPropertyNodeProperties ()
**
** Returns a list of GUIDs.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeProperties(
__in PIRP pIrp,
__in PKSP_NODE pKSProperty,
__out_opt GUID * pguidProperty
);
/*
** BdaPropertyNodeMethods ()
**
** Returns a list of GUIDs.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeMethods(
__in PIRP pIrp,
__in PKSP_NODE pKSProperty,
__out_opt GUID * pguidProperty
);
/*
** BdaPropertyNodeEvents ()
**
** Returns a list of GUIDs.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeEvents(
__in PIRP pIrp,
__in PKSP_NODE pKSProperty,
__out_opt GUID * pguidProperty
);
/*
** BdaPropertyNodeDescriptors ()
**
** Returns a list of BDA Node Descriptors.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeDescriptors(
__in PIRP pIrp,
__in PKSPROPERTY pKSProperty,
__out_opt BDANODE_DESCRIPTOR * pNodeDescriptorProperty
);
/*
** BdaPropertyGetControllingPinId ()
**
** Gets the ID of the pin on which to submit node properties, methods
** and events.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyGetControllingPinId(
__in PIRP Irp,
__in PKSP_BDA_NODE_PIN Property,
__out_opt PULONG pulControllingPinId
);
/*
** BdaStartChanges ()
**
** Starts a new set of BDA topology changes. All changes to BDA topology
** that have not been committed are ignored. Changes after this will be
** in effect only after BdaCommitChanges.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaStartChanges(
__in PIRP pIrp
);
/*
** BdaCheckChanges ()
**
** Checks the changes to BDA topology that have occured since the
** last BdaStartChanges. Returns the result that would have occurred if
** CommitChanges had been called.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaCheckChanges(
__in PIRP pIrp
);
/*
** BdaCommitChanges ()
**
** Commits the changes to BDA topology that have occured since the
** last BdaStartChanges.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaCommitChanges(
__in PIRP pIrp
);
/*
** BdaGetChangeState ()
**
** Returns the current change state of the BDA topology.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaGetChangeState(
__in PIRP pIrp,
__out_opt PBDA_CHANGE_STATE pChangeState
);
/*
** BdaMethodCreatePin ()
**
** Creates a new pin factory for the given pin type.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaMethodCreatePin(
__in PIRP pIrp,
__in PKSMETHOD pKSMethod,
__out_opt PULONG pulPinFactoryID
);
/*
** BdaMethodDeletePin ()
**
** Deletes the given pin factory
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaMethodDeletePin(
__in PIRP pIrp,
__in PKSMETHOD pKSMethod,
PVOID pvIgnored
);
/*
** BdaMethodCreateTopology ()
**
** Creates the topology between the two given pin factories.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaMethodCreateTopology(
__in PIRP pIrp,
__in PKSMETHOD pKSMethod,
OPTIONAL PVOID pvIgnored
);
/*
** BdaPropertyGetPinControl ()
**
** Returns a the BDA ID or BDA Template Type of the Pin.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaPropertyGetPinControl(
__in PIRP Irp,
__in PKSPROPERTY Property,
__out_opt ULONG * pulProperty
);
/*
** BdaValidateNodeProperty ()
**
** Validates that the node property belongs to the current pin.
**
** Arguments:
**
**
** Returns:
**
** Side Effects: none
*/
__checkReturn
__drv_requiresIRQL(PASSIVE_LEVEL)
STDMETHODIMP_(NTSTATUS)
BdaValidateNodeProperty(
__in PIRP pIrp,
__in PKSPROPERTY pProperty
);
#if defined(__cplusplus)
}
#endif // defined(__cplusplus)
#endif // !defined(_BDATOPGY_)
#endif // (NTDDI_VERSION >= NTDDI_WINXP)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
#ifndef __BTHGUID_H__
#define __BTHGUID_H__
#if (NTDDI_VERSION >= NTDDI_VISTA)
// 81A7FDF3-86C1-4BE8-A8C8-2A6D188B4177
DEFINE_GUID(GUID_BTHDDI_SDP_NODE_INTERFACE, 0x81a7fdf3, 0x86c1, 0x4be8, 0xa8, 0xc8, 0x2a, 0x6d, 0x18, 0x8b, 0x41, 0x77);
// 4E719439-9CF1-4BAB-AC1D-3279865743D2
DEFINE_GUID(GUID_BTHDDI_SDP_PARSE_INTERFACE, 0x4e719439, 0x9cf1, 0x4bab, 0xac, 0x1d, 0x32, 0x79, 0x86, 0x57, 0x43, 0xd2);
// {94A59AA8-4383-4286-AA4F-34A160F40004}
DEFINE_GUID(GUID_BTHDDI_PROFILE_DRIVER_INTERFACE, 0x94a59aa8, 0x4383, 0x4286, 0xaa, 0x4f, 0x34, 0xa1, 0x60, 0xf4, 0x0, 0x4);
#endif // (NTDDI_VERSION >= NTDDI_VISTA)
#endif // __BTHGUID_H__

View File

@ -0,0 +1,609 @@
/****************************************************************************
Copyright (c) 2000 Microsoft Corporation
Module Name:
bthioctl.h
Abstract:
defines the IOCTL codes for the kernel/user calls
Environment:
Kernel & user mode
Revision History:
4-4-00 : created by Husni Roukbi
2-4-05 : split into public and private header files by SandySp
****************************************************************************/
#ifndef __BTHIOCTL_H__
#define __BTHIOCTL_H__
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning(disable:4201) // nameless struct/union
#if (NTDDI_VERSION >= NTDDI_VISTA)
#ifndef CTL_CODE
#pragma message("CTL_CODE undefined. Include winioctl.h or wdm.h")
#endif
//
// IOCTL defines.
//
#define BTH_IOCTL_BASE 0
#define BTH_CTL(id) CTL_CODE(FILE_DEVICE_BLUETOOTH, \
(id), \
METHOD_BUFFERED, \
FILE_ANY_ACCESS)
#define BTH_KERNEL_CTL(id) CTL_CODE(FILE_DEVICE_BLUETOOTH, \
(id), \
METHOD_NEITHER, \
FILE_ANY_ACCESS)
//
// kernel-level (internal) IOCTLs
//
#define IOCTL_INTERNAL_BTH_SUBMIT_BRB BTH_KERNEL_CTL(BTH_IOCTL_BASE+0x00)
//
// Input: none
// Output: BTH_ENUMERATOR_INFO
//
#define IOCTL_INTERNAL_BTHENUM_GET_ENUMINFO BTH_KERNEL_CTL(BTH_IOCTL_BASE+0x01)
//
// Input: none
// Output: BTH_DEVICE_INFO
//
#define IOCTL_INTERNAL_BTHENUM_GET_DEVINFO BTH_KERNEL_CTL(BTH_IOCTL_BASE+0x02)
//
// IOCTLs
//
//
// Input: none
// Output: BTH_LOCAL_RADIO_INFO
//
#define IOCTL_BTH_GET_LOCAL_INFO BTH_CTL(BTH_IOCTL_BASE+0x00)
//
// Input: BTH_ADDR
// Output: BTH_RADIO_INFO
//
#define IOCTL_BTH_GET_RADIO_INFO BTH_CTL(BTH_IOCTL_BASE+0x01)
//
// use this ioctl to get a list of cached discovered devices in the port driver.
//
// Input: None
// Output: BTH_DEVICE_INFO_LIST
//
#define IOCTL_BTH_GET_DEVICE_INFO BTH_CTL(BTH_IOCTL_BASE+0x02)
//
// Input: BTH_ADDR
// Output: none
//
#define IOCTL_BTH_DISCONNECT_DEVICE BTH_CTL(BTH_IOCTL_BASE+0x03)
#if (NTDDI_VERSION > NTDDI_VISTASP1 || \
(NTDDI_VERSION == NTDDI_VISTASP1 && defined(VISTA_KB942567)))
#ifdef FULL_EIR_SUPPORT // in WUR this funcitonality is disabled
//
// Input: BTH_GET_DEVICE_RSSI
// Output: ULONG
//
#define IOCTL_BTH_GET_DEVICE_RSSI BTH_CTL(BTH_IOCTL_BASE+0x05)
//
// Input: BTH_EIR_GET_RECORDS
// Output: UCHAR array, sequence of length + type + data fields triplets.
//
#define IOCTL_BTH_EIR_GET_RECORDS BTH_CTL(BTH_IOCTL_BASE+0x10)
//
// Input: BTH_EIR_SUBMIT_RECORD
// Output HANDLE
//
#define IOCTL_BTH_EIR_SUBMIT_RECORD BTH_CTL(BTH_IOCTL_BASE+0x11)
//
// Input: BTH_EIR_SUBMIT_RECORD
// Output None
//
#define IOCTL_BTH_EIR_UPDATE_RECORD BTH_CTL(BTH_IOCTL_BASE+0x12)
//
// Input: HANDLE
// Output: None
//
#define IOCTL_BTH_EIR_REMOVE_RECORD BTH_CTL(BTH_IOCTL_BASE+0x13)
#endif // FULL_EIR_SUPPORT
//
// Input: BTH_VENDOR_SPECIFIC_COMMAND
// Output: PVOID
//
#define IOCTL_BTH_HCI_VENDOR_COMMAND BTH_CTL(BTH_IOCTL_BASE+0x14)
#endif // >= SP1+KB942567
//
// Input: BTH_SDP_CONNECT
// Output: BTH_SDP_CONNECT
//
#define IOCTL_BTH_SDP_CONNECT BTH_CTL(BTH_IOCTL_BASE+0x80)
//
// Input: HANDLE_SDP
// Output: none
//
#define IOCTL_BTH_SDP_DISCONNECT BTH_CTL(BTH_IOCTL_BASE+0x81)
//
// Input: BTH_SDP_SERVICE_SEARCH_REQUEST
// Output: ULONG * number of handles wanted
//
#define IOCTL_BTH_SDP_SERVICE_SEARCH BTH_CTL(BTH_IOCTL_BASE+0x82)
//
// Input: BTH_SDP_ATTRIBUTE_SEARCH_REQUEST
// Output: BTH_SDP_STREAM_RESPONSE or bigger
//
#define IOCTL_BTH_SDP_ATTRIBUTE_SEARCH BTH_CTL(BTH_IOCTL_BASE+0x83)
//
// Input: BTH_SDP_SERVICE_ATTRIBUTE_SEARCH_REQUEST
// Output: BTH_SDP_STREAM_RESPONSE or bigger
//
#define IOCTL_BTH_SDP_SERVICE_ATTRIBUTE_SEARCH \
BTH_CTL(BTH_IOCTL_BASE+0x84)
//
// Input: raw SDP stream (at least 2 bytes)
// Ouptut: HANDLE_SDP
//
#define IOCTL_BTH_SDP_SUBMIT_RECORD BTH_CTL(BTH_IOCTL_BASE+0x85)
//
// Input: HANDLE_SDP
// Output: none
//
#define IOCTL_BTH_SDP_REMOVE_RECORD BTH_CTL(BTH_IOCTL_BASE+0x86)
//
// Input: BTH_SDP_RECORD + raw SDP record
// Output: HANDLE_SDP
//
#define IOCTL_BTH_SDP_SUBMIT_RECORD_WITH_INFO BTH_CTL(BTH_IOCTL_BASE+0x87)
#include <PSHPACK1.H>
typedef struct _BTH_DEVICE_INFO_LIST {
//
// [IN/OUT] minimum of 1 device required
//
ULONG numOfDevices;
//
// Open ended array of devices;
//
BTH_DEVICE_INFO deviceList[1];
} BTH_DEVICE_INFO_LIST, *PBTH_DEVICE_INFO_LIST;
typedef struct _BTH_RADIO_INFO {
//
// Supported LMP features of the radio. Use LMP_XXX() to extract
// the desired bits.
//
ULONGLONG lmpSupportedFeatures;
//
// Manufacturer ID (possibly BTH_MFG_XXX)
//
USHORT mfg;
//
// LMP subversion
//
USHORT lmpSubversion;
//
// LMP version
//
UCHAR lmpVersion;
} BTH_RADIO_INFO, *PBTH_RADIO_INFO;
typedef struct _BTH_LOCAL_RADIO_INFO {
//
// Local BTH_ADDR, class of defice, and radio name
//
BTH_DEVICE_INFO localInfo;
//
// Combo of LOCAL_RADIO_XXX values
//
ULONG flags;
//
// HCI revision, see core spec
//
USHORT hciRevision;
//
// HCI version, see core spec
//
UCHAR hciVersion;
//
// More information about the local radio (LMP, MFG)
//
BTH_RADIO_INFO radioInfo;
} BTH_LOCAL_RADIO_INFO, *PBTH_LOCAL_RADIO_INFO;
#define SDP_CONNECT_CACHE (0x00000001)
#define SDP_CONNECT_ALLOW_PIN (0x00000002)
#define SDP_REQUEST_TO_DEFAULT (0)
#define SDP_REQUEST_TO_MIN (10)
#define SDP_REQUEST_TO_MAX (45)
#define SERVICE_OPTION_DO_NOT_PUBLISH (0x00000002)
#define SERVICE_OPTION_NO_PUBLIC_BROWSE (0x00000004)
#define SERVICE_OPTION_DO_NOT_PUBLISH_EIR (0x00000008)
#define SERVICE_SECURITY_USE_DEFAULTS (0x00000000)
#define SERVICE_SECURITY_NONE (0x00000001)
#define SERVICE_SECURITY_AUTHORIZE (0x00000002)
#define SERVICE_SECURITY_AUTHENTICATE (0x00000004)
#define SERVICE_SECURITY_ENCRYPT_REQUIRED (0x00000010)
#define SERVICE_SECURITY_ENCRYPT_OPTIONAL (0x00000020)
#define SERVICE_SECURITY_DISABLED (0x10000000)
#define SERVICE_SECURITY_NO_ASK (0x20000000)
//
// Do not attempt to validate that the stream can be parsed
//
#define SDP_SEARCH_NO_PARSE_CHECK (0x00000001)
//
// Do not check the format of the results. This includes suppression of both
// the check for a record patten (SEQ of UINT16 + value) and the validation
// of each universal attribute's accordance to the spec.
//
#define SDP_SEARCH_NO_FORMAT_CHECK (0x00000002)
typedef ULONGLONG HANDLE_SDP, *PHANDLE_SDP;
#define HANDLE_SDP_NULL ((HANDLE_SDP) 0x0)
#define HANDLE_SDP_LOCAL ((HANDLE_SDP) -2)
typedef struct _BTH_SDP_CONNECT {
//
// Address of the remote SDP server. Cannot be the local radio.
//
BTH_ADDR bthAddress;
//
// Combination of SDP_CONNECT_XXX flags
//
ULONG fSdpConnect;
//
// When the connect request returns, this will specify the handle to the
// SDP connection to the remote server
//
HANDLE_SDP hConnection;
//
// Timeout, in seconds, for the requests on ths SDP channel. If the request
// times out, the SDP connection represented by the HANDLE_SDP must be
// closed. The values for this field are bound by SDP_REQUEST_TO_MIN and
// SDP_REQUEST_MAX. If SDP_REQUEST_TO_DEFAULT is specified, the timeout is
// 30 seconds.
//
UCHAR requestTimeout;
} BTH_SDP_CONNECT, *PBTH_SDP_CONNECT;
typedef struct _BTH_SDP_DISCONNECT {
//
// hConnection returned by BTH_SDP_CONNECT
//
HANDLE_SDP hConnection;
} BTH_SDP_DISCONNECT, *PBTH_SDP_DISCONNECT;
typedef struct _BTH_SDP_RECORD {
//
// Combination of SERVICE_SECURITY_XXX flags
//
ULONG fSecurity;
//
// Combination of SERVICE_OPTION_XXX flags
//
ULONG fOptions;
//
// combo of COD_SERVICE_XXX flags
//
ULONG fCodService;
//
// The length of the record array, in bytes.
//
ULONG recordLength;
//
// The SDP record in its raw format
//
UCHAR record[1];
} BTH_SDP_RECORD, *PBTH_SDP_RECORD;
typedef struct _BTH_SDP_SERVICE_SEARCH_REQUEST {
//
// Handle returned by the connect request or HANDLE_SDP_LOCAL
//
HANDLE_SDP hConnection;
//
// Array of UUIDs. Each entry can be either a 2 byte, 4 byte or 16 byte
// UUID. SDP spec mandates that a request can have a maximum of 12 UUIDs.
//
SdpQueryUuid uuids[MAX_UUIDS_IN_QUERY];
} BTH_SDP_SERVICE_SEARCH_REQUEST, *PBTH_SDP_SERVICE_SEARCH_REQUEST;
typedef struct _BTH_SDP_ATTRIBUTE_SEARCH_REQUEST {
//
// Handle returned by the connect request or HANDLE_SDP_LOCAL
//
HANDLE_SDP hConnection;
//
// Combo of SDP_SEARCH_Xxx flags
//
ULONG searchFlags;
//
// Record handle returned by the remote SDP server, most likely from a
// previous BTH_SDP_SERVICE_SEARCH_RESPONSE.
//
ULONG recordHandle;
//
// Array of attributes to query for. Each SdpAttributeRange entry can
// specify either a single attribute or a range. To specify a single
// attribute, minAttribute should be equal to maxAttribute. The array must
// be in sorted order, starting with the smallest attribute. Furthermore,
// if a range is specified, the minAttribute must be <= maxAttribute.
//
SdpAttributeRange range[1];
} BTH_SDP_ATTRIBUTE_SEARCH_REQUEST, *PBTH_SDP_ATTRIBUTE_SEARCH_REQUEST;
typedef struct _BTH_SDP_SERVICE_ATTRIBUTE_SEARCH_REQUEST {
//
// Handle returned by the connect request or HANDLE_SDP_LOCAL
//
HANDLE_SDP hConnection;
//
// Combo of SDP_SEARCH_Xxx flags
//
ULONG searchFlags;
//
// See comments in BTH_SDP_SERVICE_SEARCH_REQUEST
//
SdpQueryUuid uuids[MAX_UUIDS_IN_QUERY];
//
// See comments in BTH_SDP_ATTRIBUTE_SEARCH_REQUEST
//
SdpAttributeRange range[1];
} BTH_SDP_SERVICE_ATTRIBUTE_SEARCH_REQUEST,
*PBTH_SDP_SERVICE_ATTRIBUTE_SEARCH_REQUEST;
typedef struct _BTH_SDP_STREAM_RESPONSE {
//
// The required buffer size (not including the first 2 ULONG_PTRs of this
// data structure) needed to contain the response.
//
// If the buffer passed was large enough to contain the entire response,
// requiredSize will be equal to responseSize. Otherwise, the caller should
// resubmit the request with a buffer size equal to
// sizeof(BTH_SDP_STREAM_RESPONSE) + requiredSize - 1. (The -1 is because
// the size of this data structure already includes one byte of the
// response.)
//
// A response cannot exceed 4GB in size.
//
ULONG requiredSize;
//
// The number of bytes copied into the response array of this data
// structure. If there is not enough room for the entire response, the
// response will be partially copied into the response array.
//
ULONG responseSize;
//
// The raw SDP response from the serach.
//
UCHAR response[1];
} BTH_SDP_STREAM_RESPONSE, *PBTH_SDP_STREAM_RESPONSE;
#if (NTDDI_VERSION > NTDDI_VISTASP1 || \
(NTDDI_VERSION == NTDDI_VISTASP1 && defined(VISTA_KB942567)))
//
// Vendor specific HCI command header
//
typedef struct _BTH_COMMAND_HEADER {
//
// Opcode for the command
//
USHORT OpCode;
//
// Payload of the command excluding the header.
// TotalParameterLength = TotalCommandLength - sizeof(BTH_COMMAND_HEADER)
//
UCHAR TotalParameterLength;
} BTH_COMMAND_HEADER, * PBTH_COMMAND_HEADER;
//
// Vendor Specific Command structure
//
typedef struct _BTH_VENDOR_SPECIFIC_COMMAND {
//
// Manufacturer ID
//
ULONG ManufacturerId;
//
// LMP version. Command is send to radio only if the radios
// LMP version is greater than this value.
//
UCHAR LmpVersion;
//
// Should all the patterns match or just one. If MatchAnySinglePattern == TRUE
// then if a single pattern matches the command, we decide that we have a match.
//
BOOLEAN MatchAnySinglePattern;
//
// HCI Command Header
//
BTH_COMMAND_HEADER HciHeader;
//
// Data for the above command including patterns
//
UCHAR Data[1];
} BTH_VENDOR_SPECIFIC_COMMAND, * PBTH_VENDOR_SPECIFIC_COMMAND;
//
// Structure of patterns
//
typedef struct _BTH_VENDOR_PATTERN {
//
// Pattern Offset in the event structure excluding EVENT header
//
UCHAR Offset;
//
// Size of the Pattern
//
UCHAR Size;
//
// Pattern
//
UCHAR Pattern[1];
} BTH_VENDOR_PATTERN, * PBTH_VENDOR_PATTERN;
//
//The buffer associated with GUID_BLUETOOTH_HCI_VENDOR_EVENT
//
typedef struct _BTH_VENDOR_EVENT_INFO {
//
//Local radio address with which the event is associated.
//
BTH_ADDR BthAddress;
//
//Size of the event buffer including Event header
//
ULONG EventSize;
//
//Information associated with the event
//
UCHAR EventInfo[1];
} BTH_VENDOR_EVENT_INFO, * PBTH_VENDOR_EVENT_INFO;
//
// Extended Inquiry Response data defines.
//
typedef ULONGLONG HANDLE_EIR, *PHANDLE_EIR;
#define INVALID_HANDLE_EIR_VALUE ((HANDLE_EIR)((LONGLONG)-1))
typedef struct _BTH_EIR_GET_RECORDS {
//
// [IN] Device's Bluetooth address. For local device use BTH_ADDR_NULL.
//
BTH_ADDR BthAddress;
//
// Reseved field (set to zero).
//
ULONG Reserved;
} BTH_EIR_GET_RECORDS, *PBTH_EIR_GET_RECORDS;
typedef struct _BTH_EIR_SUBMIT_RECORD {
//
// [IN/OUT] Record Handle. Set to INVALID_HANDLE_EIR_VALUE for submit.
//
HANDLE_EIR Handle;
//
// Reserved field (set to zero).
//
ULONG Reserved;
//
// [IN] Record size in bytes.
//
ULONG RecordSize;
//
// [IN] The EIR record data array (data-type and data).
//
UCHAR Record[1];
} BTH_EIR_SUBMIT_RECORD, *PBTH_EIR_SUBMIT_RECORD;
#endif // >= SP1+KB942567
#include <POPPACK.H>
#endif // (NTDDI_VERSION >= NTDDI_VISTA)
#if _MSC_VER >= 1200
#pragma warning(pop)
#else
#pragma warning(default:4201)
#endif
#endif // __BTHIOCTL_H__

View File

@ -0,0 +1,49 @@
/*++
Copyright (c) 2005 Microsoft Corporation
Module Name:
BTHREF.H
Abstract:
Public structures used for object reference counting
Environment:
Kernel & user mode
Revision History:
--*/
#ifndef __BTHREF_H__
#define __BTHREF_H__
//
// Added in Vista
//
#if (NTDDI_VERSION >= NTDDI_VISTA)
typedef struct _REF_OBJ *PREF_OBJ;
__drv_sameIRQL
typedef void (*PFNDESTROY)(__in PREF_OBJ);
typedef struct _REF_OBJ_DEBUG_INFO *PREF_OBJ_DEBUG_INFO;
typedef struct _REF_OBJ {
ULONG Count;
PFNDESTROY DestroyFunction;
PREF_OBJ_DEBUG_INFO DebugInfo;
#if DBG
ULONG Flags;
#endif
} REF_OBJ, *PREF_OBJ;
#endif // >= VISTA
#endif // __BTHREF_H__

View File

@ -0,0 +1,266 @@
#ifndef __BTHSDPDDI_H__
#define __BTHSDPDDI_H__
#if (NTDDI_VERSION >= NTDDI_VISTA)
#ifdef __cplusplus
extern "C" {
#endif
#define BTHDDI_SDP_PARSE_INTERFACE_VERSION_FOR_QI (0x0100)
#define BTHDDI_SDP_NODE_INTERFACE_VERSION_FOR_QI (0x0100)
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_TREE_ROOT_NODE (*PCREATENODETREEROOT)(__in ULONG tag);
__drv_sameIRQL
typedef NTSTATUS (*PFREETREE)(__in __drv_freesMem(Mem) PSDP_TREE_ROOT_NODE Tree);
__checkReturn
__drv_sameIRQL
typedef NTSTATUS (*PAPPENDNODETOCONTAINERNODE)(__in PSDP_NODE Container,
__in __drv_aliasesMem PSDP_NODE Node);
__checkReturn
__drv_sameIRQL
typedef NTSTATUS (*PADDATTRIBUTETOTREEE)(__in PSDP_TREE_ROOT_NODE Root,
__in USHORT AttribId,
__in __drv_aliasesMem PSDP_NODE AttribValueNode,
__in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODENIL)(__in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEBOOLEAN)(__in UCHAR bVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEUINT8)(__in UCHAR ucVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEUINT16)(__in USHORT usVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEUINT32)(__in ULONG ulVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEUINT64)(__in ULONGLONG ullVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEUINT128)(__in PSDP_ULARGE_INTEGER_16 puli16Val, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEINT8)(__in CHAR cVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEINT16)(__in SHORT sVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEINT32)(__in LONG lVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEINT64)(__in LONGLONG llVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEINT128)(__in PSDP_LARGE_INTEGER_16 pul16Val, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEUUID16)(__in USHORT usVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEUUID32)(__in ULONG ulVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEUUID128)(__in const GUID * pUuidVal, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODESTRING)(__in_bcount(stringLength) PCHAR string, __in ULONG stringLength, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEURL)(__in_bcount(urlLength) PCHAR url, __in ULONG urlLength, __in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODEALTERNATIVE)(__in ULONG tag);
__checkReturn
__drv_sameIRQL
__drv_when(return!=0, __drv_allocatesMem(Mem))
typedef PSDP_NODE (*PCREATENODESEQUENCE)(__in ULONG tag);
//
// GUID_BTHDDI_SDP_NODE_INTERFACE
//
typedef struct _BTHDDI_SDP_NODE_INTERFACE {
INTERFACE Interface;
PCREATENODETREEROOT SdpCreateNodeTree;
PFREETREE SdpFreeTree;
PCREATENODENIL SdpCreateNodeNil;
PCREATENODEBOOLEAN SdpCreateNodeBoolean;
PCREATENODEUINT8 SdpCreateNodeUint8;
PCREATENODEUINT16 SdpCreateNodeUint16;
PCREATENODEUINT32 SdpCreateNodeUint32;
PCREATENODEUINT64 SdpCreateNodeUint64;
PCREATENODEUINT128 SdpCreateNodeUint128;
PCREATENODEINT8 SdpCreateNodeInt8;
PCREATENODEINT16 SdpCreateNodeInt16;
PCREATENODEINT32 SdpCreateNodeInt32;
PCREATENODEINT64 SdpCreateNodeInt64;
PCREATENODEINT128 SdpCreateNodeInt128;
PCREATENODEUUID16 SdpCreateNodeUuid16;
PCREATENODEUUID32 SdpCreateNodeUuid32;
PCREATENODEUUID128 SdpCreateNodeUuid128;
PCREATENODESTRING SdpCreateNodeString;
PCREATENODEURL SdpCreateNodeUrl;
PCREATENODEALTERNATIVE SdpCreateNodeAlternative;
PCREATENODESEQUENCE SdpCreateNodeSequence;
PADDATTRIBUTETOTREEE SdpAddAttributeToTree;
PAPPENDNODETOCONTAINERNODE SdpAppendNodeToContainerNode;
} BTHDDI_SDP_NODE_INTERFACE, *PBTHDDI_SDP_NODE_INTERFACE;
__drv_sameIRQL
typedef void (*PBYTESWAPUUID128)(__in GUID *pUuidFrom, __out GUID *pUuiidTo);
__drv_sameIRQL
typedef void (*PBYTESWAPUINT128)(__in PSDP_ULARGE_INTEGER_16 pInUint128,
__out PSDP_ULARGE_INTEGER_16 pOutUint128);
__drv_sameIRQL
typedef ULONGLONG (*PBYTESWAPUINT64)(__in ULONGLONG uint64);
__drv_sameIRQL
typedef void (*PRETRIEVEUUID128)(__in PUCHAR Stream, __out GUID *uuid128);
__drv_sameIRQL
typedef void (*PRETRIEVEUINT128)(__in PUCHAR Stream,
__out PSDP_ULARGE_INTEGER_16 pUint128);
__drv_sameIRQL
typedef void (*PRETRIEVEUINT64)(__in PUCHAR Stream, __out PULONGLONG pUint16);
__checkReturn
__drv_sameIRQL
typedef NTSTATUS (*PVALIDATESTREAM)(__in_bcount(Size) PUCHAR Stream,
__in ULONG Size,
__out PULONG_PTR ErrorByte);
__checkReturn
__drv_sameIRQL
typedef NTSTATUS (*PFINDATTRIBUTEINTREE)(__in PSDP_TREE_ROOT_NODE Tree,
__in USHORT AttribId,
__deref_out PSDP_NODE *AttribValue);
__checkReturn
__drv_sameIRQL
typedef NTSTATUS (*PCONVERTTREETOSTREAM)(__in PSDP_TREE_ROOT_NODE Root,
__post __drv_when(return==0, __drv_allocatesMem(Mem)) PUCHAR *Stream,
__out PULONG Size,
__in ULONG tag);
__checkReturn
__drv_sameIRQL
typedef NTSTATUS (*PCONVERTSTREAMTOTREE)(__in_bcount(Size) PUCHAR Stream,
__in ULONG Size,
__out PSDP_TREE_ROOT_NODE *Node,
__in ULONG tag);
__drv_sameIRQL
typedef VOID (*PGETNEXTELEMENT)(__in_bcount(StreamSize) PUCHAR Stream,
__in ULONG StreamSize,
__in PUCHAR CurrentElement,
__deref_out_bcount(*NextElementSize) PUCHAR* NextElement,
__out PULONG NextElementSize);
typedef VOID (*pReservedFunction)();
#ifndef __BTHSDPDDIP_H__
typedef struct _BTHDDI_SDP_PARSE_INTERFACE {
INTERFACE Interface;
PVALIDATESTREAM SdpValidateStream;
PCONVERTSTREAMTOTREE SdpConvertStreamToTree;
PCONVERTTREETOSTREAM SdpConvertTreeToStream;
PFREETREE SdpFreeTree;
PBYTESWAPUUID128 SdpByteSwapUuid128;
PBYTESWAPUINT128 SdpByteSwapUint128;
PBYTESWAPUINT64 SdpByteSwapUint64;
PRETRIEVEUUID128 SdpRetrieveUuid128;
PRETRIEVEUINT128 SdpRetrieveUint128;
PRETRIEVEUINT64 SdpRetrieveUint64;
PFINDATTRIBUTEINTREE SdpFindAttributeInTree;
PGETNEXTELEMENT SdpGetNextElement;
pReservedFunction Reserved1;
pReservedFunction Reserved2;
pReservedFunction Reserved3;
pReservedFunction Reserved4;
} BTHDDI_SDP_PARSE_INTERFACE, *PBTHDDI_SDP_PARSE_INTERFACE;
#endif
#ifdef __cplusplus
}
#endif
#endif // (NTDDI_VERSION >= NTDDI_VISTA)
#endif // __BTHSDPDDI_H__

View File

@ -0,0 +1,166 @@
/*++ BUILD Version: 0009 // Increment this if a change has global effects
Copyright (c) 1987-1993 Microsoft Corporation
Module Name:
buffring.h
Abstract:
This module defines the change buffering state requests related data structures in RDBSS.
Author:
Notes:
The buffering manager implementation consists of two primary data structures
(1) CHANGE_BUFFERING_STATE_REQUEST and (2) BUFFERING_MANAGER.
The BUFFERING_MANAGER tracks and initiates actions on all change buffering state
requests generated by the various mini redirectors as well as the RDBSS.
There are three lists associated with the buffering manager, i.e., the registration
list, the dispatcher list and the handler list.
The registration list contains all the requests initiated for which no processing
has been done. All DPC level indications merely register the indication in this
list. The access to this list is protected by a spin lock(RxStrucsupSpinLock).
The dispatcher list contains all the requests for which the lookup has not been
completed. This list is organized as a two tier list. The top level is based on
the NetRootKey. Each entry for a NetRootKey in this list has an associated cluster
of requests corresponding to the various SrvOpenKey's. This is the reason for
ghaving two LIST_ENTRY's in the request data structure as well. The
NetRootListEntry field is used for inter cluster threading and the listEntry
field is used for intra cluster threading.
The handler list consists of all the requests for which the lookup has been completed
and are awaiting processing.
The dispatcher list and the handler list access is protected by the buffering manager
mutex.
The three routines of interest to mini rdr writers are ...
1) RxIndicateChangeOfBufferingState -- for registering the request.
2) RxAssociateSrvOpenKey -- for associating a SRV_OPEN instance with the key.
Note that the key associations are irreverisble and will last the lifetime of the
associated SRV_OPEN.
Also note that 0 and 0xffffffff are not valid keys for SRV_OPEN. It has special
significance for the buffering manager.
--*/
#ifndef __BUFFRING_H__
#define __BUFFRING_H__
#define RX_REQUEST_PREPARED_FOR_HANDLING (0x10000000)
typedef struct _CHANGE_BUFFERING_STATE_REQUEST_ {
LIST_ENTRY ListEntry;
ULONG Flags;
PSRV_OPEN SrvOpen;
PVOID SrvOpenKey;
PVOID MRxContext;
} CHANGE_BUFFERING_STATE_REQUEST, *PCHANGE_BUFFERING_STATE_REQUEST;
typedef struct _RX_BUFFERING_MANAGER_ {
BOOLEAN DispatcherActive;
BOOLEAN HandlerInactive;
BOOLEAN LastChanceHandlerActive;
UCHAR Pad;
KSPIN_LOCK SpinLock;
//
// This count is always incremented and never reset. This provides us with
// a quick mechanism to establish if a buffering state change request has
// been received for a given srvcall since a point in time.
//
__volatile LONG CumulativeNumberOfBufferingChangeRequests;
LONG NumberOfUnhandledRequests;
LONG NumberOfUndispatchedRequests;
__volatile LONG NumberOfOutstandingOpens;
LIST_ENTRY DispatcherList;
LIST_ENTRY HandlerList;
LIST_ENTRY LastChanceHandlerList;
RX_WORK_QUEUE_ITEM DispatcherWorkItem;
RX_WORK_QUEUE_ITEM HandlerWorkItem;
RX_WORK_QUEUE_ITEM LastChanceHandlerWorkItem;
FAST_MUTEX Mutex;
LIST_ENTRY SrvOpenLists[1];
} RX_BUFFERING_MANAGER, *PRX_BUFFERING_MANAGER;
#define RxAcquireBufferingManagerMutex(BUFMAN) ExAcquireFastMutex( &(BUFMAN)->Mutex )
#define RxReleaseBufferingManagerMutex(BUFMAN) ExReleaseFastMutex( &(BUFMAN)->Mutex )
VOID
RxpProcessChangeBufferingStateRequests (
PSRV_CALL SrvCall,
BOOLEAN UpdateHandlerState
);
VOID
RxProcessChangeBufferingStateRequests (
PSRV_CALL SrvCall
);
VOID
RxProcessFcbChangeBufferingStateRequest (
PFCB Fcb
);
VOID
RxPurgeChangeBufferingStateRequestsForSrvOpen(
PSRV_OPEN SrvOpen
);
VOID
RxCompleteSrvOpenKeyAssociation (
IN OUT PSRV_OPEN SrvOpen
);
VOID
RxInitiateSrvOpenKeyAssociation (
IN OUT PSRV_OPEN SrvOpen
);
NTSTATUS
RxInitializeBufferingManager (
PSRV_CALL SrvCall
);
NTSTATUS
RxTearDownBufferingManager (
PSRV_CALL SrvCall
);
NTSTATUS
RxFlushFcbInSystemCache (
IN PFCB Fcb,
IN BOOLEAN SynchronizeWithLazyWriter
);
NTSTATUS
RxPurgeFcbInSystemCache (
IN PFCB Fcb,
IN PLARGE_INTEGER FileOffset OPTIONAL,
IN ULONG Length,
IN BOOLEAN UninitializeCacheMaps,
IN BOOLEAN FlushFile
);
#endif __BUFFRING_H__

View File

@ -0,0 +1,291 @@
/*
* CalendarDeviceService.h
*
* Contains declarations for the Calendar Device Service
*
* Copyright (c) Microsoft Corporation, All Rights Reserved.
*
*/
#ifndef _CALENDARDEVICESERVICE_H_
#define _CALENDARDEVICESERVICE_H_
#include <DeviceServices.h>
#include <MessageDeviceService.h>
#include <SyncDeviceService.h>
/*****************************************************************************/
/* Calendar Service Info */
/*****************************************************************************/
DEFINE_DEVSVCGUID(SERVICE_Calendar,
0xE4DFDBD3, 0x7F04, 0x45E9, 0x9F, 0xA1, 0x5C, 0xA0, 0xEA, 0xEB, 0x0A, 0xE3);
#define NAME_CalendarSvc L"Calendar"
#define TYPE_CalendarSvc DEVSVCTYPE_DEFAULT
/*****************************************************************************/
/* Calendar Service Properties */
/*****************************************************************************/
DEFINE_DEVSVCGUID(NAMESPACE_CalendarSvc,
0x63816297, 0x61E5, 0x4306, 0xB1, 0xA3, 0xCE, 0xDF, 0x48, 0x1B, 0x86, 0x29);
/* PKEY_CalendarSvc_SyncInWindowOnly
*/
#define PKEY_CalendarSvc_SyncInWindowOnly PKEY_SyncSvc_FilterType
#define NAME_CalendarSvc_SyncInWindowOnly NAME_SyncSvc_FilterType
/* PKEY_CalendarSvc_SyncWindowStart
*
* Indicates the number of minutes before TODAY that the sync window starts
*
* Type: UInt32
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarSvc_SyncWindowStart,
0x63816297, 0x61E5, 0x4306, 0xB1, 0xA3, 0xCE, 0xDF, 0x48, 0x1B, 0x86, 0x29,
2);
#define NAME_CalendarSvc_SyncWindowStart L"SyncWindowStart"
/* PKEY_CalendarSvc_SyncWindowEnd
*
* Indicates the number of minutes after TODAY that the sync window ends
*
* Type: UInt32
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarSvc_SyncWindowEnd,
0x63816297, 0x61E5, 0x4306, 0xB1, 0xA3, 0xCE, 0xDF, 0x48, 0x1B, 0x86, 0x29,
3);
#define NAME_CalendarSvc_SyncWindowEnd L"SyncWindowEnd"
/*****************************************************************************/
/* Calendar Service Object Formats */
/*****************************************************************************/
/* FORMAT_AbstractActivity
*/
DEFINE_DEVSVCGUID(FORMAT_AbstractActivity,
0xbf70e114, 0x3901, 0x4449, 0xbe, 0xe7, 0xd9, 0xea, 0x14, 0x93, 0xc3, 0x09);
#define NAME_AbstractActivity L"AbstractActivity"
/* FORMAT_AbstractActivityOccurrence
*/
DEFINE_DEVSVCGUID(FORMAT_AbstractActivityOccurrence,
0xE87A7008, 0x32D1, 0x42C5, 0x84, 0x88, 0x4C, 0x23, 0x58, 0x66, 0xAF, 0x32);
#define NAME_AbstractActivityOccurrence L"AbstractActivityOccurrence"
/* FORMAT_VCalendar1Activity
*/
DEFINE_DEVSVCGUID(FORMAT_VCalendar1Activity,
0x23F7A5A5, 0xF7D3, 0x4585, 0xA1, 0xFF, 0x76, 0xE2, 0xD4, 0x5C, 0x91, 0x21);
#define NAME_VCalendar1Activity L"VCalendar1"
/* FORMAT_ICalendarActivity
*
* iCalendar file format (vCalendar Version 2)
*/
DEFINE_DEVSVCGUID(FORMAT_ICalendarActivity,
0xCC4538CB, 0x7890, 0x41B7, 0xA3, 0xF1, 0xB6, 0xE6, 0x0B, 0xDD, 0x2A, 0x61);
#define NAME_ICalendarActivity L"ICalendar"
/*****************************************************************************/
/* Calendar Service Object Property Keys */
/*****************************************************************************/
DEFINE_DEVSVCGUID(NAMESPACE_CalendarObj,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3);
/* CalendarObj.Location
*
* MTP Property: Activity Location (0xDD52)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_Location,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
3);
#define NAME_CalendarObj_Location L"Location"
/* CalendarObj.Accepted
*
* MTP Property: Activity Accepted (0xDD57)
* Type: AUInt16
* Form: LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_Accepted,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
10);
#define NAME_CalendarObj_Accepted L"Accepted"
/* CalendarObj.Tentative
*
* MTP Property: Activity Tentative (0xDD58)
* Type: AUInt16
* Form: LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_Tentative,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
12);
#define NAME_CalendarObj_Tentative L"Tentative"
/* CalendarObj.Declined
*
* MTP Property: Activity Declined (0xDD59)
* Type: AUInt16
* Form: LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_Declined,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
13);
#define NAME_CalendarObj_Declined L"Declined"
/* CalendarObj.TimeZone
*
* Contains the TZ Database name for the time zone in which the appointment
* was created.
* Type: String
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_TimeZone,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
14);
#define NAME_CalendarObj_TimeZone L"TimeZone"
/* CalendarObj.ReminderOffset
*
* Contains the offset in minutes from the start of the appointment that
* a reminder is to be fired.
*
* Type: UInt32
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_ReminderOffset,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
15);
#define NAME_CalendarObj_ReminderOffset L"ReminderOffset"
/* CalendarObj.BusyStatus
*
* Contains the free/busy status for the specified appointment.
*
* Type: UInt16
* Form: Enum
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_BusyStatus,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
16);
#define NAME_CalendarObj_BusyStatus L"BusyStatus"
#define ENUM_CalendarObj_BusyStatusFree 0x0000
#define ENUM_CalendarObj_BusyStatusBusy 0x0001
#define ENUM_CalendarObj_BusyStatusOutOfOffice 0x0002
#define ENUM_CalendarObj_BusyStatusTentative 0x0003
/* CalendarObj.PatternStartTime
*
* Contains the time of day at which a recurring item is to start. The
* format is the time portion of an ISO 8601 DateTime value- e.g. HHMMSS.S
*
* Type: String
* Form: ISO 8601 Time
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_PatternStartTime,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
17);
#define NAME_CalendarObj_PatternStartTime L"PatternStartTime"
/* CalendarObj.PatternDuration
*
* Contains the duration of the recurring item in minutes.
*
* Type: UInt32
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_PatternDuration,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
18);
#define NAME_CalendarObj_PatternDuration L"PatternDuration"
/* CalendarObj.BeginDateTime
*
* Contains the UTC date and time that the calendar item begins
*
* Type: String
* Form: DateTime
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_BeginDateTime,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
19);
#define NAME_CalendarObj_BeginDateTime L"BeginDateTime"
/* CalendarObj.EndDateTime
*
* Contains the UTC date and time that the calendar item ends
*
* Type: String
* Form: DateTime
*/
DEFINE_DEVSVCPROPKEY(PKEY_CalendarObj_EndDateTime,
0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3,
20);
#define NAME_CalendarObj_EndDateTime L"EndDateTime"
#endif /* _CALENDARDEVICESERVICE_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
/*=============================================================================
Copyright (c) 1998 Microsoft Corporation
Module Name:
clfslsn.h
Abstract:
Header file containing the private definition for the common log
file system's log sequence number structure.
Author:
Dexter Bradshaw [DexterB] 09-Dec-1998
Revision History:
=============================================================================*/
#ifndef _CLFS_LSN_H_
#define _CLFS_LSN_H_
#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03)
//
// CLFS_RECORD_INDEX
//
// Log record offset on container file. The log record offset consists of a block
// offset in the container and a bucket identifier indexing the records in the block.
// Declared up here because including clfs_x.h will try to define the LSN, which needs
// this.
//
typedef UINT32 CLFS_RECORD_INDEX;
#endif /* NTDDI_VERSION || _WIN32_WINNT */
#if (NTDDI_VERSION >= NTDDI_WS03SP1) || (_WIN32_WINNT >= _WIN32_WINNT_WS03)
//
// CLS_LSN
//
// The log sequence number (LSN) is a valid log file address. The LSN consists of
// three (3) parts: (a) a log identifier to identify which physical log the log record
// belongs to, (b) a container index identifying the log container where the log record
// lies, and (c) a record offset identified by the offset of the block in the container
// and an ordinal number for the record within the container.
//
//
// The structure of the LSN poses some inherent limitations of the number of logs,
// the number of containers, the size of a container, and the number of log records in
// a log block.
//
// Maximum number of physical log files is 64K.
// Maximum number of container identifiers is 4G.
// Maximum size of a container is 4G.
// Maximum number of sector-aligned log blocks is 8M
// Maximum number of record buckets in a log block is 512
//
typedef union _CLS_LSN
{
//
// Container identifier
//
struct
{
CLFS_RECORD_INDEX idxRecord; // Record offset on container.
CLFS_CONTAINER_ID cidContainer; // Container identifier.
} offset;
__volatile ULONGLONG ullOffset; // Sequence number within physical log.
} CLS_LSN, *PCLS_LSN, **PPCLS_LSN;
//
// Alias CLS prefixed types with CLFS prefixes.
//
typedef CLS_LSN CLFS_LSN;
typedef CLFS_LSN *PCLFS_LSN, **PPCLFS_LSN;
#endif /* NTDDI_VERSION || _WIN32_WINNT */
#endif

View File

@ -0,0 +1,164 @@
/*=============================================================================
Copyright (c) 1998 Microsoft Corporation
Module Name:
clfsmsg.mc
Abstract:
Common log file system (CLFS) driver message file.
Author:
Dexter Bradshaw [DexterB] 17-Dec-1998
Environment:
Kernel mode
Revision History:
=============================================================================*/
//
// Values are 32 bit values laid out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
#define FACILITY_RPC_STUBS 0x3
#define FACILITY_RPC_RUNTIME 0x2
#define FACILITY_IO_ERROR_CODE 0x4
#define FACILITY_CLFS_ERROR_CODE 0x9
//
// Define the severity codes
//
#define STATUS_SEVERITY_WARNING 0x2
#define STATUS_SEVERITY_SUCCESS 0x0
#define STATUS_SEVERITY_INFORMATIONAL 0x1
#define STATUS_SEVERITY_ERROR 0x3
//
// MessageId: CLFS_MSG_LOGGING_ENABLED
//
// MessageText:
//
// Event logging enabled for Common Log File System.
//
#define CLFS_MSG_LOGGING_ENABLED ((NTSTATUS)0x400919FAL)
//
// MessageId: CLFS_MSG_DRIVER_STARTING
//
// MessageText:
//
// Common Log File System driver has successfully initialized.
//
#define CLFS_MSG_DRIVER_STARTING ((NTSTATUS)0x400919FBL)
//
// MessageId: CLFS_MSG_DRIVER_STOPPING
//
// MessageText:
//
// Common Log File System driver has unloaded.
//
#define CLFS_MSG_DRIVER_STOPPING ((NTSTATUS)0x400919FCL)
//
// MessageId: CLFS_MSG_OPENING_HANDLE
//
// MessageText:
//
// Opening handle to %1.
//
#define CLFS_MSG_OPENING_HANDLE ((NTSTATUS)0x400919FDL)
//
// MessageId: CLFS_MSG_CLOSING_HANDLE
//
// MessageText:
//
// Closing handle to %1.
//
#define CLFS_MSG_CLOSING_HANDLE ((NTSTATUS)0x400919FEL)
//
// MessageId: CLFS_MSG_FLUSH_FAILED
//
// MessageText:
//
// %1 log flush failed because of media write error.
//
#define CLFS_MSG_FLUSH_FAILED ((NTSTATUS)0x400919FFL)
//
// MessageId: CLFS_MSG_METADATA_READ_FAILED
//
// MessageText:
//
// %1 log metadata read failed because of media write error.
//
#define CLFS_MSG_METADATA_READ_FAILED ((NTSTATUS)0x40091A00L)
//
// MessageId: CLFS_MSG_METADATA_FLUSH_FAILED
//
// MessageText:
//
// %1 log metadata flush failed because of media write error.
//
#define CLFS_MSG_METADATA_FLUSH_FAILED ((NTSTATUS)0x40091A01L)
//
// MessageId: CLFS_MSG_OWNERPAGE_READ_FAILED
//
// MessageText:
//
// %1 log owner page read failed because of media error.
//
#define CLFS_MSG_OWNERPAGE_READ_FAILED ((NTSTATUS)0x40091A02L)
//
// MessageId: CLFS_MSG_OWNERPAGE_WRITE_FAILED
//
// MessageText:
//
// %1 log owner page write failed because of media error.
//
#define CLFS_MSG_OWNERPAGE_WRITE_FAILED ((NTSTATUS)0x40091A03L)
//-----------------------------------------------------------------------------
// End of File
//-----------------------------------------------------------------------------

View File

@ -0,0 +1,409 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 7.00.0555 */
/* Compiler settings for cloneviewhelper.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __cloneviewhelper_h__
#define __cloneviewhelper_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __ICloneViewHelper_FWD_DEFINED__
#define __ICloneViewHelper_FWD_DEFINED__
typedef interface ICloneViewHelper ICloneViewHelper;
#endif /* __ICloneViewHelper_FWD_DEFINED__ */
#ifndef __IViewHelper_FWD_DEFINED__
#define __IViewHelper_FWD_DEFINED__
typedef interface IViewHelper IViewHelper;
#endif /* __IViewHelper_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_cloneviewhelper_0000_0000 */
/* [local] */
#define GETCONNECTEDIDS_TARGET 0
#define GETCONNECTEDIDS_SOURCE 1
#define S_INIT 2
// 0 == TMM's passed in configuration was applied
#define SETCONFIGURATION_STATUS_APPLIED 0
// 1 == TMM's passed in configuration was applied, with additional proprietary IHV settings
#define SETCONFIGURATION_STATUS_ADDITIONAL 1
// 2 == TMM's passed in configuration was overridden and IHV's own settings were applied
#define SETCONFIGURATION_STATUS_OVERRIDDEN 2
// Topology Data
typedef struct tagSources
{
ULONG sourceId;
int numTargets;
ULONG aTargets[1];
} Sources;
typedef struct tagAdapter
{
WCHAR AdapterName[128];
int numSources;
Sources sources[1];
} Adapter;
typedef struct tagAdapters
{
int numAdapters;
Adapter adapter[1];
} Adapters;
// Display Mode Data
typedef struct tagDisplayMode
{
WCHAR DeviceName[32];
DEVMODEW devMode;
} DisplayMode;
typedef struct tagDisplayModes
{
int numDisplayModes;
DisplayMode displayMode[1];
} DisplayModes;
extern RPC_IF_HANDLE __MIDL_itf_cloneviewhelper_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_cloneviewhelper_0000_0000_v0_0_s_ifspec;
#ifndef __ICloneViewHelper_INTERFACE_DEFINED__
#define __ICloneViewHelper_INTERFACE_DEFINED__
/* interface ICloneViewHelper */
/* [unique][helpstring][nonextensible][uuid][object] */
EXTERN_C const IID IID_ICloneViewHelper;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("F6A3D4C4-5632-4D83-B0A1-FB88712B1EB7")
ICloneViewHelper : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetConnectedIDs(
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [out][in] */ __RPC__inout ULONG *pulCount,
/* [out][in] */ __RPC__inout ULONG *pulID,
/* [in] */ ULONG ulFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE GetActiveTopology(
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [in] */ ULONG ulSourceID,
/* [out][in] */ __RPC__inout ULONG *pulCount,
/* [out][in] */ __RPC__inout ULONG *pulTargetID) = 0;
virtual HRESULT STDMETHODCALLTYPE SetActiveTopology(
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [in] */ ULONG ulSourceID,
/* [in] */ ULONG ulCount,
/* [in] */ __RPC__in ULONG *pulTargetID) = 0;
virtual HRESULT STDMETHODCALLTYPE Commit(
/* [in] */ BOOL fFinalCall) = 0;
};
#else /* C style interface */
typedef struct ICloneViewHelperVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ICloneViewHelper * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ICloneViewHelper * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ICloneViewHelper * This);
HRESULT ( STDMETHODCALLTYPE *GetConnectedIDs )(
__RPC__in ICloneViewHelper * This,
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [out][in] */ __RPC__inout ULONG *pulCount,
/* [out][in] */ __RPC__inout ULONG *pulID,
/* [in] */ ULONG ulFlags);
HRESULT ( STDMETHODCALLTYPE *GetActiveTopology )(
__RPC__in ICloneViewHelper * This,
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [in] */ ULONG ulSourceID,
/* [out][in] */ __RPC__inout ULONG *pulCount,
/* [out][in] */ __RPC__inout ULONG *pulTargetID);
HRESULT ( STDMETHODCALLTYPE *SetActiveTopology )(
__RPC__in ICloneViewHelper * This,
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [in] */ ULONG ulSourceID,
/* [in] */ ULONG ulCount,
/* [in] */ __RPC__in ULONG *pulTargetID);
HRESULT ( STDMETHODCALLTYPE *Commit )(
__RPC__in ICloneViewHelper * This,
/* [in] */ BOOL fFinalCall);
END_INTERFACE
} ICloneViewHelperVtbl;
interface ICloneViewHelper
{
CONST_VTBL struct ICloneViewHelperVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ICloneViewHelper_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ICloneViewHelper_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ICloneViewHelper_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ICloneViewHelper_GetConnectedIDs(This,wszAdaptorName,pulCount,pulID,ulFlags) \
( (This)->lpVtbl -> GetConnectedIDs(This,wszAdaptorName,pulCount,pulID,ulFlags) )
#define ICloneViewHelper_GetActiveTopology(This,wszAdaptorName,ulSourceID,pulCount,pulTargetID) \
( (This)->lpVtbl -> GetActiveTopology(This,wszAdaptorName,ulSourceID,pulCount,pulTargetID) )
#define ICloneViewHelper_SetActiveTopology(This,wszAdaptorName,ulSourceID,ulCount,pulTargetID) \
( (This)->lpVtbl -> SetActiveTopology(This,wszAdaptorName,ulSourceID,ulCount,pulTargetID) )
#define ICloneViewHelper_Commit(This,fFinalCall) \
( (This)->lpVtbl -> Commit(This,fFinalCall) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ICloneViewHelper_INTERFACE_DEFINED__ */
#ifndef __IViewHelper_INTERFACE_DEFINED__
#define __IViewHelper_INTERFACE_DEFINED__
/* interface IViewHelper */
/* [unique][helpstring][nonextensible][uuid][object] */
EXTERN_C const IID IID_IViewHelper;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("E85CCEF5-AAAA-47f0-B5E3-61F7AECDC4C1")
IViewHelper : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetConnectedIDs(
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [out][in] */ __RPC__inout ULONG *pulCount,
/* [out][in] */ __RPC__inout ULONG *pulID,
/* [in] */ ULONG ulFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE GetActiveTopology(
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [in] */ ULONG ulSourceID,
/* [out][in] */ __RPC__inout ULONG *pulCount,
/* [out][in] */ __RPC__inout ULONG *pulTargetID) = 0;
virtual HRESULT STDMETHODCALLTYPE SetActiveTopology(
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [in] */ ULONG ulSourceID,
/* [in] */ ULONG ulCount,
/* [in] */ __RPC__in ULONG *pulTargetID) = 0;
virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0;
virtual HRESULT STDMETHODCALLTYPE SetConfiguration(
/* [in] */ __RPC__in_opt IStream *pIStream,
/* [out] */ __RPC__out ULONG *pulStatus) = 0;
virtual HRESULT STDMETHODCALLTYPE GetProceedOnNewConfiguration( void) = 0;
};
#else /* C style interface */
typedef struct IViewHelperVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IViewHelper * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IViewHelper * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IViewHelper * This);
HRESULT ( STDMETHODCALLTYPE *GetConnectedIDs )(
__RPC__in IViewHelper * This,
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [out][in] */ __RPC__inout ULONG *pulCount,
/* [out][in] */ __RPC__inout ULONG *pulID,
/* [in] */ ULONG ulFlags);
HRESULT ( STDMETHODCALLTYPE *GetActiveTopology )(
__RPC__in IViewHelper * This,
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [in] */ ULONG ulSourceID,
/* [out][in] */ __RPC__inout ULONG *pulCount,
/* [out][in] */ __RPC__inout ULONG *pulTargetID);
HRESULT ( STDMETHODCALLTYPE *SetActiveTopology )(
__RPC__in IViewHelper * This,
/* [in] */ __RPC__in LPCWSTR wszAdaptorName,
/* [in] */ ULONG ulSourceID,
/* [in] */ ULONG ulCount,
/* [in] */ __RPC__in ULONG *pulTargetID);
HRESULT ( STDMETHODCALLTYPE *Commit )(
__RPC__in IViewHelper * This);
HRESULT ( STDMETHODCALLTYPE *SetConfiguration )(
__RPC__in IViewHelper * This,
/* [in] */ __RPC__in_opt IStream *pIStream,
/* [out] */ __RPC__out ULONG *pulStatus);
HRESULT ( STDMETHODCALLTYPE *GetProceedOnNewConfiguration )(
__RPC__in IViewHelper * This);
END_INTERFACE
} IViewHelperVtbl;
interface IViewHelper
{
CONST_VTBL struct IViewHelperVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IViewHelper_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IViewHelper_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IViewHelper_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IViewHelper_GetConnectedIDs(This,wszAdaptorName,pulCount,pulID,ulFlags) \
( (This)->lpVtbl -> GetConnectedIDs(This,wszAdaptorName,pulCount,pulID,ulFlags) )
#define IViewHelper_GetActiveTopology(This,wszAdaptorName,ulSourceID,pulCount,pulTargetID) \
( (This)->lpVtbl -> GetActiveTopology(This,wszAdaptorName,ulSourceID,pulCount,pulTargetID) )
#define IViewHelper_SetActiveTopology(This,wszAdaptorName,ulSourceID,ulCount,pulTargetID) \
( (This)->lpVtbl -> SetActiveTopology(This,wszAdaptorName,ulSourceID,ulCount,pulTargetID) )
#define IViewHelper_Commit(This) \
( (This)->lpVtbl -> Commit(This) )
#define IViewHelper_SetConfiguration(This,pIStream,pulStatus) \
( (This)->lpVtbl -> SetConfiguration(This,pIStream,pulStatus) )
#define IViewHelper_GetProceedOnNewConfiguration(This) \
( (This)->lpVtbl -> GetProceedOnNewConfiguration(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IViewHelper_INTERFACE_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,103 @@
// CloneViewHelper.idl : IDL source for ICloneViewHelper
//
import "oaidl.idl";
import "ocidl.idl";
cpp_quote("#define GETCONNECTEDIDS_TARGET 0")
cpp_quote("#define GETCONNECTEDIDS_SOURCE 1")
cpp_quote("#define S_INIT 2")
cpp_quote("// 0 == TMM's passed in configuration was applied")
cpp_quote("#define SETCONFIGURATION_STATUS_APPLIED 0")
cpp_quote("// 1 == TMM's passed in configuration was applied, with additional proprietary IHV settings")
cpp_quote("#define SETCONFIGURATION_STATUS_ADDITIONAL 1")
cpp_quote("// 2 == TMM's passed in configuration was overridden and IHV's own settings were applied")
cpp_quote("#define SETCONFIGURATION_STATUS_OVERRIDDEN 2")
cpp_quote("")
cpp_quote("// Topology Data")
cpp_quote("")
cpp_quote("typedef struct tagSources")
cpp_quote("{")
cpp_quote(" ULONG sourceId;")
cpp_quote(" int numTargets;")
cpp_quote(" ULONG aTargets[1];")
cpp_quote("} Sources;")
cpp_quote("")
cpp_quote("typedef struct tagAdapter")
cpp_quote("{")
cpp_quote(" WCHAR AdapterName[128];")
cpp_quote(" int numSources;")
cpp_quote(" Sources sources[1];")
cpp_quote("} Adapter;")
cpp_quote("")
cpp_quote("typedef struct tagAdapters")
cpp_quote("{")
cpp_quote(" int numAdapters;")
cpp_quote(" Adapter adapter[1];")
cpp_quote("} Adapters;")
cpp_quote("")
cpp_quote("// Display Mode Data")
cpp_quote("")
cpp_quote("typedef struct tagDisplayMode")
cpp_quote("{")
cpp_quote(" WCHAR DeviceName[32];")
cpp_quote(" DEVMODEW devMode;")
cpp_quote("} DisplayMode;")
cpp_quote("")
cpp_quote("typedef struct tagDisplayModes")
cpp_quote("{")
cpp_quote(" int numDisplayModes;")
cpp_quote(" DisplayMode displayMode[1];")
cpp_quote("} DisplayModes;")
cpp_quote("")
[
object,
uuid(F6A3D4C4-5632-4D83-B0A1-FB88712B1EB7),
nonextensible,
helpstring("ICloneViewHelper Interface"),
pointer_default(unique)
]
interface ICloneViewHelper : IUnknown
{
HRESULT GetConnectedIDs( [in] LPCWSTR wszAdaptorName,
[in,out] ULONG * pulCount,
[in,out] ULONG * pulID,
[in] ULONG ulFlags);
HRESULT GetActiveTopology([in] LPCWSTR wszAdaptorName,
[in] ULONG ulSourceID,
[in,out] ULONG * pulCount,
[in,out] ULONG * pulTargetID);
HRESULT SetActiveTopology([in] LPCWSTR wszAdaptorName,
[in] ULONG ulSourceID,
[in] ULONG ulCount,
[in] ULONG * pulTargetID);
HRESULT Commit( [in] BOOL fFinalCall);
};
[
object,
uuid(E85CCEF5-AAAA-47f0-B5E3-61F7AECDC4C1),
nonextensible,
helpstring("IViewHelper Interface"),
pointer_default(unique)
]
interface IViewHelper : IUnknown
{
HRESULT GetConnectedIDs( [in] LPCWSTR wszAdaptorName,
[in,out] ULONG * pulCount,
[in,out] ULONG * pulID,
[in] ULONG ulFlags);
HRESULT GetActiveTopology([in] LPCWSTR wszAdaptorName,
[in] ULONG ulSourceID,
[in,out] ULONG * pulCount,
[in,out] ULONG * pulTargetID);
HRESULT SetActiveTopology([in] LPCWSTR wszAdaptorName,
[in] ULONG ulSourceID,
[in] ULONG ulCount,
[in] ULONG * pulTargetID);
HRESULT Commit();
HRESULT SetConfiguration( [in] IStream * pIStream,
[out] ULONG * pulStatus);
HRESULT GetProceedOnNewConfiguration();
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,937 @@
/*
* ContactDeviceService.h
*
* Contains declarations for the Contact Device Service
*
* Copyright (c) Microsoft Corporation, All Rights Reserved.
*
*/
#ifndef _CONTACTDEVICESERVICE_H_
#define _CONTACTDEVICESERVICE_H_
#include <DeviceServices.h>
#include <SyncDeviceService.h>
/*****************************************************************************/
/* Contact Service Info */
/*****************************************************************************/
DEFINE_DEVSVCGUID(SERVICE_Contacts,
0xDD04D5FC, 0x9D6E, 0x4F76, 0x9D, 0xCF, 0xEC, 0xA6, 0x33, 0x9B, 0x73, 0x89);
#define NAME_ContactsSvc L"Contacts"
#define TYPE_ContactsSvc DEVSVCTYPE_DEFAULT
/*****************************************************************************/
/* Contact Service Property /
/*****************************************************************************/
#define PKEY_ContactSvc_SyncWithPhoneOnly PKEY_SyncSvc_FilterType
#define NAME_ContactSvc_SyncWithPhoneOnly NAME_SyncSvc_FilterType
/*****************************************************************************/
/* Contact Service Object Formats */
/*****************************************************************************/
/* FORMAT_AbstractContact
*/
DEFINE_DEVSVCGUID(FORMAT_AbstractContact,
0xBB810000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7);
#define NAME_AbstractContact L"AbstractContact"
/* FORMAT_VCard2Contact
*/
DEFINE_DEVSVCGUID(FORMAT_VCard2Contact,
0xBB820000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7);
#define NAME_VCard2Contact L"VCard2Contact"
/* FORMAT_VCard3Contact
*/
DEFINE_DEVSVCGUID(FORMAT_VCard3Contact,
0xBB830000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7);
#define NAME_VCard3Contact L"VCard3Contact"
/* FORMAT_AbstractContactGroup
*/
DEFINE_DEVSVCGUID(FORMAT_AbstractContactGroup,
0xBA060000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7);
#define NAME_AbstractContactGroup L"AbstractContactGroup"
/*****************************************************************************/
/* Contact Service Object Property Keys */
/*****************************************************************************/
DEFINE_DEVSVCGUID(NAMESPACE_ContactObj,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B);
/* ContactObj.GivenName
*
* MTP Property: Given Name (0xDD00)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_GivenName,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
3);
#define NAME_ContactObj_GivenName L"GivenName"
/* ContactObj.MiddleNames
*
* MTP Property: Middle Names (0xDD01)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_MiddleNames,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
4);
#define NAME_ContactObj_MiddleNames L"MiddleNames"
/* ContactObj.FamilyName
*
* MTP Property: Family Name (0xDD02)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_FamilyName,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
5);
#define NAME_ContactObj_FamilyName L"FamilyName"
/* ContactObj.Title
*
* MTP Property: Prefix (0xDD03)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Title,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
6);
#define NAME_ContactObj_Title L"Title"
/* ContactObj.Suffix
*
* MTP Property: Suffix (0xDD04)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Suffix,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
7);
#define NAME_ContactObj_Suffix L"Suffix"
/* ContactObj.PhoneticGivenName
*
* MTP Property: Phonetic Given Name (0xDD05)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PhoneticGivenName,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
8);
#define NAME_ContactObj_PhoneticGivenName L"PhoneticGivenName"
/* ContactObj.PhoneticFamilyName
*
* MTP Property: Phonetic Family Name (0xDD06)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PhoneticFamilyName,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
9);
#define NAME_ContactObj_PhoneticFamilyName L"PhoneticFamilyName"
/* ContactObj.PersonalAddressFull
*
* MTP Property: Postal Address Personal Full (0xDD1F)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalAddressFull,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
10);
#define NAME_ContactObj_PersonalAddressFull L"PersonalAddressFull"
/* ContactObj.PersonalAddressStreet
*
* MTP Property: Postal Address Line 1 (0xDD20)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalAddressStreet,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
11);
#define NAME_ContactObj_PersonalAddressStreet L"PersonalAddressStreet"
/* ContactObj.PersonalAddressLine2
*
* MTP Property: Postal Address Line 2 (0xDD21)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalAddressLine2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
12);
#define NAME_ContactObj_PersonalAddressLine2 L"PersonalAddressLine2"
/* ContactObj.PersonalAddressCity
*
* MTP Property: Postal Address Personal City (0xDD22)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalAddressCity,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
13);
#define NAME_ContactObj_PersonalAddressCity L"PersonalAddressCity"
/* ContactObj.PersonalAddressRegion
*
* MTP Property: Postal Address Personal Region (0xDD23)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalAddressRegion,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
14);
#define NAME_ContactObj_PersonalAddressRegion L"PersonalAddressRegion"
/* ContactObj.PersonalAddressPostalCode
*
* MTP Property: Postal Address Personal Postal Code (0xDD24)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalAddressPostalCode,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
15);
#define NAME_ContactObj_PersonalAddressPostalCode L"PersonalAddressPostalCode"
/* ContactObj.PersonalAddressCountry
*
* MTP Property: Postal Address Personal Country (0xDD25)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalAddressCountry,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
16);
#define NAME_ContactObj_PersonalAddressCountry L"PersonalAddressCountry"
/* ContactObj.BusinessAddressFull
*
* MTP Property: Postal Address Business Full (0xDD26)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessAddressFull,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
17);
#define NAME_ContactObj_BusinessAddressFull L"BusinessAddressFull"
/* ContactObj.BusinessAddressStreet
*
* MTP Property: Postal Address Line 1 (0xDD27)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessAddressStreet,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
18);
#define NAME_ContactObj_BusinessAddressStreet L"BusinessAddressStreet"
/* ContactObj.BusinessAddressLine2
*
* MTP Property: Postal Address Line 2 (0xDD28)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessAddressLine2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
19);
#define NAME_ContactObj_BusinessAddressLine2 L"BusinessAddressLine2"
/* ContactObj.BusinessAddressCity
*
* MTP Property: Postal Address Business City (0xDD29)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessAddressCity,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
20);
#define NAME_ContactObj_BusinessAddressCity L"BusinessAddressCity"
/* ContactObj.BusinessAddressRegion
*
* MTP Property: Postal Address Business Region (0xDD2A)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessAddressRegion,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
21);
#define NAME_ContactObj_BusinessAddressRegion L"BusinessAddressRegion"
/* ContactObj.BusinessAddressPostalCode
*
* MTP Property: Postal Address Business Postal Code (0xDD2B)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessAddressPostalCode,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
22);
#define NAME_ContactObj_BusinessAddressPostalCode L"BusinessAddressPostalCode"
/* ContactObj.BusinessAddressCountry
*
* MTP Property: Postal Address Business Country (0xDD2C)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessAddressCountry,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
23);
#define NAME_ContactObj_BusinessAddressCountry L"BusinessAddressCountry"
/* ContactObj.OtherAddressFull
*
* MTP Property: Postal Address Other Full (0xDD2D)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherAddressFull,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
24);
#define NAME_ContactObj_OtherAddressFull L"OtherAddressFull"
/* ContactObj.OtherAddressStreet
*
* MTP Property: Postal Address Line 1 (0xDD2E)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherAddressStreet,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
25);
#define NAME_ContactObj_OtherAddressStreet L"OtherAddressStreet"
/* ContactObj.OtherAddressLine2
*
* MTP Property: Postal Address Line 2 (0xDD2F)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherAddressLine2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
26);
#define NAME_ContactObj_OtherAddressLine2 L"OtherAddressLine2"
/* ContactObj.OtherAddressCity
*
* MTP Property: Postal Address Other City (0xDD30)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherAddressCity,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
27);
#define NAME_ContactObj_OtherAddressCity L"OtherAddressCity"
/* ContactObj.OtherAddressRegion
*
* MTP Property: Postal Address Other Region (0xDD31)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherAddressRegion,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
28);
#define NAME_ContactObj_OtherAddressRegion L"OtherAddressRegion"
/* ContactObj.OtherAddressPostalCode
*
* MTP Property: Postal Address Other Postal Code (0xDD32)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherAddressPostalCode,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
29);
#define NAME_ContactObj_OtherAddressPostalCode L"OtherAddressPostalCode"
/* ContactObj.OtherAddressCountry
*
* MTP Property: Postal Address Other Country (0xDD33)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherAddressCountry,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
30);
#define NAME_ContactObj_OtherAddressCountry L"OtherAddressCountry"
/* ContactObj.Email
*
* MTP Property: Email Primary (0xDD07)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Email,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
31);
#define NAME_ContactObj_Email L"Email"
/* ContactObj.PersonalEmail
*
* MTP Property: Email Personal 1 (0xDD08)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalEmail,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
32);
#define NAME_ContactObj_PersonalEmail L"PersonalEmail"
/* ContactObj.PersonalEmail2
*
* MTP Property: Email Personal 2 (0xDD09)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalEmail2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
33);
#define NAME_ContactObj_PersonalEmail2 L"PersonalEmail2"
/* ContactObj.BusinessEmail
*
* MTP Property: Email Business 1 (0xDD0A)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessEmail,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
34);
#define NAME_ContactObj_BusinessEmail L"BusinessEmail"
/* ContactObj.BuisnessEmail2
*
* MTP Property: Email Business 2 (0xDD0B)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessEmail2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
35);
#define NAME_ContactObj_BusinessEmail2 L"BusinessEmail2"
/* ContactObj.OtherEmail
*
* MTP Property: Email Others (0xDD0C)
* Type: AUInt16
* Form: LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherEmail,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
36);
#define NAME_ContactObj_OtherEmail L"OtherEmail"
/* ContactObj.Phone
*
* MTP Property: Phone Primary (0xDD0D)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Phone,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
37);
#define NAME_ContactObj_Phone L"Phone"
/* ContactObj.PersonalPhone
*
* MTP Property: Phone Number Personal 1 (0xDD0E)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalPhone,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
38);
#define NAME_ContactObj_PersonalPhone L"PersonalPhone"
/* ContactObj.PersonalPhone2
*
* MTP Property: Phone Number Personal 2 (0xDD0F)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalPhone2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
39);
#define NAME_ContactObj_PersonalPhone2 L"PersonalPhone2"
/* ContactObj.BusinessPhone
*
* MTP Property: Phone Number Business 1 (0xDD10)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessPhone,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
40);
#define NAME_ContactObj_BusinessPhone L"BusinessPhone"
/* ContactObj.BusinessPhone2
*
* MTP Property: Phone Number Business 2 (0xDD11)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessPhone2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
41);
#define NAME_ContactObj_BusinessPhone2 L"BusinessPhone2"
/* ContactObj.MobilePhone
*
* MTP Property: Phone Number Mobile 1 (0xDD12)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_MobilePhone,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
42);
#define NAME_ContactObj_MobilePhone L"MobilePhone"
/* ContactObj.MobilePhone2
*
* MTP Property: Phone Number Mobile 2 (0xDD13)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_MobilePhone2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
43);
#define NAME_ContactObj_MobilePhone2 L"MobilePhone2"
/* ContactObj.PersonalFax
*
* MTP Property: Fax Number Personal (0xDD15)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalFax,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
44);
#define NAME_ContactObj_PersonalFax L"PersonalFax"
/* ContactObj.BusinessFax
*
* MTP Property: Fax Number Business (0xDD16)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessFax,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
45);
#define NAME_ContactObj_BusinessFax L"BusinessFax"
/* ContactObj.Pager
*
* MTP Property: Pager Number (0xDD17)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Pager,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
46);
#define NAME_ContactObj_Pager L"Pager"
/* ContactObj.OtherPhone
*
* MTP Property: Phone Number Others (0xDD18)
* Type: AUInt16
* Form: LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_OtherPhone,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
47);
#define NAME_ContactObj_OtherPhone L"OtherPhone"
/* ContactObj.WebAddress
*
* MTP Property: Primary Web Address (0xDD19)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_WebAddress,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
48);
#define NAME_ContactObj_WebAddress L"WebAddress"
/* ContactObj.PersonalWebAddress
*
* MTP Property: Personal Web Address (0xDD1A)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PersonalWebAddress,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
49);
#define NAME_ContactObj_PersonalWebAddress L"PersonalWebAddress"
/* ContactObj.BusinessWebAddress
*
* MTP Property: Business Web Address (0xDD1B)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_BusinessWebAddress,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
50);
#define NAME_ContactObj_BusinessWebAddress L"BusinessWebAddress"
/* ContactObj.IMAddress
*
* MTP Property: Instant Messanger Address (0xDD1C)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_IMAddress,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
51);
#define NAME_ContactObj_IMAddress L"IMAddress"
/* ContactObj.IMAddress2
*
* MTP Property: Instant Messanger Address 2 (0xDD1D)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_IMAddress2,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
52);
#define NAME_ContactObj_IMAddress2 L"IMAddress2"
/* ContactObj.IMAddress3
*
* MTP Property: Instant Messanger Address 3 (0xDD1E)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_IMAddress3,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
53);
#define NAME_ContactObj_IMAddress3 L"IMAddress3"
/* ContactObj.Organization
*
* MTP Property: Organization Name (0xDD34)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Organization,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
54);
#define NAME_ContactObj_Organization L"Organization"
/* ContactObj.PhoneticOrganization
*
* MTP Property: Phonetic Organization Name (0xDD35)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_PhoneticOrganization,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
55);
#define NAME_ContactObj_PhoneticOrganization L"PhoneticOrganization"
/* ContactObj.Role
*
* MTP Property: Role (0xDD36)
* Type: String/AUInt16
* Form: None/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Role,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
56);
#define NAME_ContactObj_Role L"Role"
/* ContactObj.Fax
*
* MTP Property: Fax Number Primary (0xDD14)
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Fax,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
58);
#define NAME_ContactObj_Fax L"Fax"
/* ContactObj.Spouse
*
* MTP Property: ()
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Spouse,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
59);
#define NAME_ContactObj_Spouse L"Spouse"
/* ContactObj.Children
*
* MTP Property: ()
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Children,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
60);
#define NAME_ContactObj_Children L"Children"
/* ContactObj.Assistant
*
* MTP Property: ()
* Type: String/AUInt16
* Form: None/RegEx/LongString
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Assistant,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
61);
#define NAME_ContactObj_Assistant L"Assistant"
/* ContactObj.Ringtone
*
* MTP Property: ()
* Type: UInt32
* Form: ObjectID
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Ringtone,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
63);
#define NAME_ContactObj_Ringtone L"Ringtone"
/* ContactObj.Birthdate
*
* MTP Property: (0xDD37)
* Type: String
* Form: DateTime
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_Birthdate,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
65);
#define NAME_ContactObj_Birthdate L"Birthdate"
/* ContactObj.AnniversaryDate
*
* MTP Property: ()
* Type: String
* Form: DateTime
*/
DEFINE_DEVSVCPROPKEY(PKEY_ContactObj_AnniversaryDate,
0xFBD4FDAB, 0x987D, 0x4777, 0xB3, 0xF9, 0x72, 0x61, 0x85, 0xA9, 0x31, 0x2B,
66);
#define NAME_ContactObj_AnniversaryDate L"AnniversaryDate"
#endif /* _CONTACTDEVICESERVICE_H_ */

View File

@ -0,0 +1,310 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
csq.h
Abstract:
This header exposes the cancel safe queue DDIs for use on Win2K at later.
Drivers that use this header should link to csq.lib. If a driver only needs
to work on XP or later, neither this header or the lib are required (the
XP kernel supports the cancel safe queue DDIs natively.)
Revision History:
--*/
// Cancel SAFE DDI set start
//
// The following DDIs are to help ease the pain of writing queue packages that
// handle the cancellation race well. The idea of this set of DDIs is to not
// force a single queue data structure but allow the cancel logic to be hidden
// from the drivers. A driver implements a queue and as part of its header
// includes the IO_CSQ structure. In its initialization routine it calls
// IoInitializeCsq. Then in the dispatch routine when the driver wants to
// insert an IRP into the queue it calls IoCsqInsertIrp. When the driver wants
// to remove something from the queue it calls IoCsqRemoveIrp. Note that Insert
// can fail if the IRP was cancelled in the meantime. Remove can also fail if
// the IRP was already cancelled.
//
// There are typically two modes where drivers queue IRPs. These two modes are
// covered by the cancel safe queue DDI set.
//
// Mode 1:
// One is where the driver queues the IRP and at some later
// point in time dequeues an IRP and issues the IO request.
// For this mode the driver should use IoCsqInsertIrp and IoCsqRemoveNextIrp.
// The driver in this case is expected to pass NULL to the irp context
// parameter in IoInsertIrp.
//
// Mode 2:
// In this the driver queues theIRP, issues the IO request (like issuing a DMA
// request or writing to a register) and when the IO request completes (either
// using a DPC or timer) the driver dequeues the IRP and completes it. For this
// mode the driver should use IoCsqInsertIrp and IoCsqRemoveIrp. In this case
// the driver should allocate an IRP context and pass it in to IoCsqInsertIrp.
// The cancel DDI code creates an association between the IRP and the context
// and thus ensures that when the time comes to remove the IRP it can ascertain
// correctly.
//
// Note that the cancel DDI set assumes that the field DriverContext[3] is
// always available for use and that the driver does not use it.
//
#ifndef _CSQ_H_
#define _CSQ_H_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
//
// If the wdm.h/ntddk.h we're including already defines cancel safe DDIs, we
// can skip the structure definitions. Otherwise, we do the rest here:
//
#ifndef IO_TYPE_CSQ_IRP_CONTEXT
//
// Bookkeeping structure. This should be opaque to drivers.
// Drivers typically include this as part of their queue headers.
// Given a CSQ pointer the driver should be able to get its
// queue header using CONTAINING_RECORD macro
//
typedef struct _IO_CSQ IO_CSQ, *PIO_CSQ;
#define IO_TYPE_CSQ_IRP_CONTEXT 1
#define IO_TYPE_CSQ 2
//
// IRP context structure. This structure is necessary if the driver is using
// the second mode.
//
typedef struct _IO_CSQ_IRP_CONTEXT {
ULONG Type;
PIRP Irp;
PIO_CSQ Csq;
} IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
//
// Routines that insert/remove IRP
//
typedef VOID
IO_CSQ_INSERT_IRP (
__in struct _IO_CSQ *Csq,
__in PIRP Irp
);
typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
typedef VOID
IO_CSQ_REMOVE_IRP (
__in PIO_CSQ Csq,
__in PIRP Irp
);
typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
//
// Retrieves next entry after Irp from the queue.
// Returns NULL if there are no entries in the queue.
// If Irp is NUL, returns the entry in the head of the queue.
// This routine does not remove the IRP from the queue.
//
typedef PIRP
IO_CSQ_PEEK_NEXT_IRP (
__in PIO_CSQ Csq,
__in PIRP Irp,
__in PVOID PeekContext
);
typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
//
// Lock routine that protects the cancel safe queue.
//
typedef VOID
IO_CSQ_ACQUIRE_LOCK (
__in PIO_CSQ Csq,
__out PKIRQL Irql
);
typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
typedef VOID
IO_CSQ_RELEASE_LOCK (
__in PIO_CSQ Csq,
__in KIRQL Irql
);
typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
//
// Completes the IRP with STATUS_CANCELLED. IRP is guaranteed to be valid
// In most cases this routine just calls IoCompleteRequest(Irp, STATUS_CANCELLED);
//
typedef VOID
IO_CSQ_COMPLETE_CANCELED_IRP (
__in PIO_CSQ Csq,
__in PIRP Irp
);
typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
//
// Bookkeeping structure. This should be opaque to drivers.
// Drivers typically include this as part of their queue headers.
// Given a CSQ pointer the driver should be able to get its
// queue header using CONTAINING_RECORD macro
//
typedef struct _IO_CSQ {
ULONG Type;
PIO_CSQ_INSERT_IRP CsqInsertIrp;
PIO_CSQ_REMOVE_IRP CsqRemoveIrp;
PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp;
PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock;
PIO_CSQ_RELEASE_LOCK CsqReleaseLock;
PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp;
PVOID ReservePointer; // Future expansion
} IO_CSQ, *PIO_CSQ;
#endif // IO_TYPE_CSQ_IRP_CONTEXT
//
// Add in new extensions to the csq.h library.
//
#ifndef IO_TYPE_CSQ_EX
#define IO_TYPE_CSQ_EX 3
typedef NTSTATUS
IO_CSQ_INSERT_IRP_EX (
__in struct _IO_CSQ *Csq,
__in PIRP Irp,
__in PVOID InsertContext
);
typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
#endif // IO_TYPE_CSQ_EX
//
// These defines ensure the backward compatible CSQ library can be used within
// the XP build environment in which the kernel supports the functions natively.
//
#define CSQLIB_DDI(x) Wdmlib##x
//
// Initializes the cancel queue structure.
//
#undef IoCsqInitialize
#define IoCsqInitialize WdmlibIoCsqInitialize
NTSTATUS
CSQLIB_DDI(IoCsqInitialize)(
__in PIO_CSQ Csq,
__in PIO_CSQ_INSERT_IRP CsqInsertIrp,
__in PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
__in PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
__in PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
__in PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
__in PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp
);
#undef IoCsqInitializeEx
#define IoCsqInitializeEx WdmlibIoCsqInitializeEx
NTSTATUS
CSQLIB_DDI(IoCsqInitializeEx)(
__in PIO_CSQ Csq,
__in PIO_CSQ_INSERT_IRP_EX CsqInsertIrp,
__in PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
__in PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
__in PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
__in PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
__in PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp
);
//
// The caller calls this routine to insert the IRP and return STATUS_PENDING.
//
#undef IoCsqInsertIrp
#define IoCsqInsertIrp WdmlibIoCsqInsertIrp
VOID
CSQLIB_DDI(IoCsqInsertIrp)(
__in PIO_CSQ Csq,
__in PIRP Irp,
__in_opt PIO_CSQ_IRP_CONTEXT Context
);
#undef IoCsqInsertIrpEx
#define IoCsqInsertIrpEx WdmlibIoCsqInsertIrpEx
NTSTATUS
CSQLIB_DDI(IoCsqInsertIrpEx)(
__in PIO_CSQ Csq,
__in PIRP Irp,
__in_opt PIO_CSQ_IRP_CONTEXT Context,
__in_opt PVOID InsertContext
);
//
// Returns an IRP if one can be found. NULL otherwise.
//
#undef IoCsqRemoveNextIrp
#define IoCsqRemoveNextIrp WdmlibIoCsqRemoveNextIrp
PIRP
CSQLIB_DDI(IoCsqRemoveNextIrp)(
__in PIO_CSQ Csq,
__in_opt PVOID PeekContext
);
//
// This routine is called from timeout or DPCs.
// The context is presumably part of the DPC or timer context.
// If succesfull returns the IRP associated with context.
//
#undef IoCsqRemoveIrp
#define IoCsqRemoveIrp WdmlibIoCsqRemoveIrp
PIRP
CSQLIB_DDI(IoCsqRemoveIrp)(
__in PIO_CSQ Csq,
__in PIO_CSQ_IRP_CONTEXT Context
);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _CSQ_H_
// Cancel SAFE DDI set end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
#ifndef _D3DHALEX_H
#define _D3DHALEX_H
//-----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: d3dhalex.h
// Content: Direct3D HAL Extensions and Helpers include file
// This file contains definitions and macros which although not
// essential for building a driver are useful helpers and
// utilities.
//
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//
// Macros to help with handling the new GetDriverInfo2 mechanism. The following
// macros assist with handling the GetDriverInfo2 sub-call of GetDriverInfo.
// Two of the macros are simplified ways of differentiating between
// GetDriverInfo2 calls and DDStereoMode calls. The others are simplified ways
// of getting the data structures associated with those two calls.
//
// The following code fragment demonstrates how to handle GetDriverInfo2 using
// these macros. Compare this with the code fragment in d3dhal.h
//
// D3DCAPS8 myD3DCaps8;
//
// DWORD CALLBACK
// DdGetDriverInfo(LPDDHAL_GETDRIVERINFODATA lpData)
// {
// if (MATCH_GUID((lpData->guidInfo), GUID_GetDriverInfo2) )
// {
// ASSERT(NULL != lpData);
// ASSERT(NULL != lpData->lpvData);
//
// // Is this a call to GetDriverInfo2 or DDStereoMode?
// if (D3DGDI_IS_GDI2(lpData))
// {
// // Yes, its a call to GetDriverInfo2, fetch the
// // DD_GETDRIVERINFO2DATA data structure.
// DD_GETDRIVERINFO2DATA* pgdi2 = D3DGDI_GET_GDI2_DATA(lpData);
// ASSERT(NULL != pgdi2);
//
// // What type of request is this?
// switch (pgdi2->dwType)
// {
// case D3DGDI2_TYPE_GETD3DCAPS8:
// {
// // The runtime is requesting the DX8 D3D caps so
// // copy them over now.
//
// // It should be noted that the dwExpectedSize field
// // of DD_GETDRIVERINFODATA is not used for
// // GetDriverInfo2 calls and should be ignored.
// size_t copySize = min(sizeof(myD3DCaps8), pgdi2->dwExpectedSize);
// memcpy(lpData->lpvData, &myD3DCaps8, copySize);
// lpData->dwActualSize = copySize;
// lpData->ddRVal = DD_OK;
// return DDHAL_DRIVER_HANDLED;
// }
// default:
// // For any other GetDriverInfo2 types not handled
// // or understood by the driver set an ddRVal of
// // DDERR_CURRENTLYNOTAVAIL and return
// // DDHAL_DRIVER_HANDLED.
// return DDHAL_DRIVER_HANDLED;
// }
// }
// else
// {
// // It must be a call a request for stereo mode support.
// // Fetch the stereo mode data
// DD_STEREOMODE* pStereoMode = D3DGDI_GET_STEREOMODE_DATA(pData);
// ASSERT(NULL != pStereoMode);
//
// // Process the stereo mode request...
// lpData->dwActualSize = sizeof(DD_STEREOMODE);
// lpData->ddRVal = DD_OK;
// return DDHAL_DRIVER_HANDLED;
// }
// }
//
// // Handle any other device GUIDs...
//
// } // DdGetDriverInfo
//
//-----------------------------------------------------------------------------
//
// Macros to determine what type of call a call to GetDriverInfo with the
// GUID GUID_GetDriverInfo2/GUID_DDStereoMode. A GetDriverInfo2 call or
// a DDStereoMode call.
//
#define D3DGDI_IS_GDI2(pData) \
((((DD_GETDRIVERINFO2DATA*)(pData->lpvData))->dwMagic) == D3DGDI2_MAGIC)
#define D3DGDI_IS_STEREOMODE(pData) \
((((DD_STEREOMODE*) (pData->lpvData))->dwHeight) != D3DGDI2_MAGIC)
//
// Macros to return the appropriate GetDriverInfo data structure for a
// call to GetDriverInfo with the GUID GUID_GetDriverInfo2/GUID_DDStereoMode.
//
#define D3DGDI_GET_GDI2_DATA(pData) \
(D3DGDI_IS_GDI2(pData) ? (((DD_GETDRIVERINFO2DATA*)(pData->lpvData))) : NULL)
#define D3DGDI_GET_STEREOMODE_DATA(pData) \
(D3DGDI_IS_STEREOMODE(pData) ? (((DD_STEREOMODE*)(pData->lpvData))) : NULL)
#endif /* _D3DHALEX_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,758 @@
/******************************Module*Header************************************\
*
* Module Name: d3dukmdt.h
*
* Content: Longhorn Display Driver Model (LDDM) user/kernel mode
* shared data type definitions.
*
* Copyright (c) 2003 Microsoft Corporation. All rights reserved.
\*******************************************************************************/
#ifndef _D3DUKMDT_H_
#define _D3DUKMDT_H_
#if !defined(_D3DKMDT_H) && \
!defined(_D3DKMTHK_H_) && \
!defined(_D3DUMDDI_H_) && \
!defined(__DXGKRNLETW_H__)
#error This header should not be included directly!
#endif
#pragma warning(push)
#pragma warning(disable:4201) // anonymous unions warning
//
// WDDM DDI Interface Version
//
#define DXGKDDI_INTERFACE_VERSION_VISTA 0x1052
#define DXGKDDI_INTERFACE_VERSION_VISTA_SP1 0x1053
#define DXGKDDI_INTERFACE_VERSION_WIN7 0x2005
#if !defined(DXGKDDI_INTERFACE_VERSION)
#define DXGKDDI_INTERFACE_VERSION DXGKDDI_INTERFACE_VERSION_WIN7
#endif // !defined(DXGKDDI_INTERFACE_VERSION)
#define D3D_UMD_INTERFACE_VERSION_VISTA 0x000C
#define D3D_UMD_INTERFACE_VERSION_WIN7 0x2003
#if !defined(D3D_UMD_INTERFACE_VERSION)
#define D3D_UMD_INTERFACE_VERSION D3D_UMD_INTERFACE_VERSION_WIN7
#endif // !defined(D3D_UMD_INTERFACE_VERSION)
//
// Available only for Vista (LONGHORN) and later and for
// multiplatform tools such as debugger extensions
//
#if (NTDDI_VERSION >= NTDDI_LONGHORN) || defined(D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL)
typedef ULONGLONG D3DGPU_VIRTUAL_ADDRESS;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Purpose: Video present source unique identification number descriptor type
//
typedef UINT D3DDDI_VIDEO_PRESENT_SOURCE_ID;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Purpose: Video present source unique identification number descriptor type.
//
typedef UINT D3DDDI_VIDEO_PRESENT_TARGET_ID;
//
// DDI level handle that represents a kernel mode object (allocation, device, etc)
//
typedef UINT D3DKMT_HANDLE;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Purpose: Video present target mode fractional frequency descriptor type.
//
// Remarks: Fractional value used to represent vertical and horizontal frequencies of a video mode
// (i.e. VSync and HSync). Vertical frequencies are stored in Hz. Horizontal frequencies
// are stored in Hz.
// The dynamic range of this encoding format, given 10^-7 resolution is {0..(2^32 - 1) / 10^7},
// which translates to {0..428.4967296} [Hz] for vertical frequencies and {0..428.4967296} [Hz]
// for horizontal frequencies. This sub-microseconds precision range should be acceptable even
// for a pro-video application (error in one microsecond for video signal synchronization would
// imply a time drift with a cycle of 10^7/(60*60*24) = 115.741 days.
//
// If rational number with a finite fractional sequence, use denominator of form 10^(length of fractional sequence).
// If rational number without a finite fractional sequence, or a sequence exceeding the precision allowed by the
// dynamic range of the denominator, or an irrational number, use an appropriate ratio of integers which best
// represents the value.
//
typedef struct _D3DDDI_RATIONAL
{
UINT Numerator;
UINT Denominator;
} D3DDDI_RATIONAL;
typedef struct _D3DDDI_ALLOCATIONINFO
{
D3DKMT_HANDLE hAllocation; // out: Private driver data for allocation
CONST VOID* pSystemMem; // in: Pointer to pre-allocated sysmem
VOID* pPrivateDriverData; // in(out optional): Private data for each allocation
UINT PrivateDriverDataSize; // in: Size of the private data
D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPN source ID if this is a primary
union
{
struct
{
UINT Primary : 1; // 0x00000001
UINT Reserved :31; // 0xFFFFFFFE
};
UINT Value;
} Flags;
} D3DDDI_ALLOCATIONINFO;
#if ((DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) || \
(D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WIN7))
typedef struct _D3DDDI_ALLOCATIONINFO2
{
D3DKMT_HANDLE hAllocation; // out: Private driver data for allocation
CONST VOID* pSystemMem; // in: Pointer to pre-allocated sysmem
VOID* pPrivateDriverData; // in(out optional): Private data for each allocation
UINT PrivateDriverDataSize; // in: Size of the private data
D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPN source ID if this is a primary
union
{
struct
{
UINT Primary : 1; // 0x00000001
UINT Reserved :31; // 0xFFFFFFFE
};
UINT Value;
} Flags;
D3DGPU_VIRTUAL_ADDRESS GpuVirtualAddress; // out: GPU Virtual address of the allocation created.
ULONG_PTR Reserved[6]; // Reserved
} D3DDDI_ALLOCATIONINFO2;
#endif
typedef struct _D3DDDI_OPENALLOCATIONINFO
{
D3DKMT_HANDLE hAllocation; // in: Handle for this allocation in this process
CONST VOID* pPrivateDriverData; // in: Ptr to driver private buffer for this allocations
UINT PrivateDriverDataSize; // in: Size in bytes of driver private buffer for this allocations
} D3DDDI_OPENALLOCATIONINFO;
#if ((DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) || \
(D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WIN7))
typedef struct _D3DDDI_OPENALLOCATIONINFO2
{
D3DKMT_HANDLE hAllocation; // in: Handle for this allocation in this process
CONST VOID* pPrivateDriverData; // in: Ptr to driver private buffer for this allocations
UINT PrivateDriverDataSize; // in: Size in bytes of driver private buffer for this allocations
D3DGPU_VIRTUAL_ADDRESS GpuVirtualAddress; // out: GPU Virtual address of the allocation opened.
ULONG_PTR Reserved[6]; // Reserved
} D3DDDI_OPENALLOCATIONINFO2;
#endif
typedef struct _D3DDDI_ALLOCATIONLIST
{
D3DKMT_HANDLE hAllocation;
union
{
struct
{
UINT WriteOperation : 1; // 0x00000001
UINT DoNotRetireInstance : 1; // 0x00000002
UINT Reserved :30; // 0xFFFFFFFC
};
UINT Value;
};
} D3DDDI_ALLOCATIONLIST;
typedef struct _D3DDDI_PATCHLOCATIONLIST
{
UINT AllocationIndex;
union
{
struct
{
UINT SlotId : 24; // 0x00FFFFFF
UINT Reserved : 8; // 0xFF000000
};
UINT Value;
};
UINT DriverId;
UINT AllocationOffset;
UINT PatchOffset;
UINT SplitOffset;
} D3DDDI_PATCHLOCATIONLIST;
typedef struct _D3DDDICB_LOCKFLAGS
{
union
{
struct
{
UINT ReadOnly : 1; // 0x00000001
UINT WriteOnly : 1; // 0x00000002
UINT DonotWait : 1; // 0x00000004
UINT IgnoreSync : 1; // 0x00000008
UINT LockEntire : 1; // 0x00000010
UINT DonotEvict : 1; // 0x00000020
UINT AcquireAperture : 1; // 0x00000040
UINT Discard : 1; // 0x00000080
UINT NoExistingReference : 1; // 0x00000100
UINT UseAlternateVA : 1; // 0x00000200
UINT IgnoreReadSync : 1; // 0x00000400
UINT Reserved :21; // 0xFFFFF800
};
UINT Value;
};
} D3DDDICB_LOCKFLAGS;
typedef struct _D3DDDI_ESCAPEFLAGS
{
union
{
struct
{
UINT HardwareAccess : 1; // 0x00000001
UINT Reserved :31; // 0xFFFFFFFE
};
UINT Value;
};
} D3DDDI_ESCAPEFLAGS;
typedef struct _D3DDDI_CREATECONTEXTFLAGS
{
union
{
struct
{
UINT NullRendering : 1; // 0x00000001
UINT Reserved : 31; // 0xFFFFFFFE
};
UINT Value;
};
} D3DDDI_CREATECONTEXTFLAGS;
/* Formats
* Most of these names have the following convention:
* A = Alpha
* R = Red
* G = Green
* B = Blue
* X = Unused Bits
* P = Palette
* L = Luminance
* U = dU coordinate for BumpMap
* V = dV coordinate for BumpMap
* S = Stencil
* D = Depth (e.g. Z or W buffer)
* C = Computed from other channels (typically on certain read operations)
*
* Further, the order of the pieces are from MSB first; hence
* D3DFMT_A8L8 indicates that the high byte of this two byte
* format is alpha.
*
* D16 indicates:
* - An integer 16-bit value.
* - An app-lockable surface.
*
* All Depth/Stencil formats except D3DFMT_D16_LOCKABLE indicate:
* - no particular bit ordering per pixel, and
* - are not app lockable, and
* - the driver is allowed to consume more than the indicated
* number of bits per Depth channel (but not Stencil channel).
*/
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
#endif /* defined(MAKEFOURCC) */
typedef enum _D3DDDIFORMAT
{
D3DDDIFMT_UNKNOWN = 0,
D3DDDIFMT_R8G8B8 = 20,
D3DDDIFMT_A8R8G8B8 = 21,
D3DDDIFMT_X8R8G8B8 = 22,
D3DDDIFMT_R5G6B5 = 23,
D3DDDIFMT_X1R5G5B5 = 24,
D3DDDIFMT_A1R5G5B5 = 25,
D3DDDIFMT_A4R4G4B4 = 26,
D3DDDIFMT_R3G3B2 = 27,
D3DDDIFMT_A8 = 28,
D3DDDIFMT_A8R3G3B2 = 29,
D3DDDIFMT_X4R4G4B4 = 30,
D3DDDIFMT_A2B10G10R10 = 31,
D3DDDIFMT_A8B8G8R8 = 32,
D3DDDIFMT_X8B8G8R8 = 33,
D3DDDIFMT_G16R16 = 34,
D3DDDIFMT_A2R10G10B10 = 35,
D3DDDIFMT_A16B16G16R16 = 36,
D3DDDIFMT_A8P8 = 40,
D3DDDIFMT_P8 = 41,
D3DDDIFMT_L8 = 50,
D3DDDIFMT_A8L8 = 51,
D3DDDIFMT_A4L4 = 52,
D3DDDIFMT_V8U8 = 60,
D3DDDIFMT_L6V5U5 = 61,
D3DDDIFMT_X8L8V8U8 = 62,
D3DDDIFMT_Q8W8V8U8 = 63,
D3DDDIFMT_V16U16 = 64,
D3DDDIFMT_W11V11U10 = 65,
D3DDDIFMT_A2W10V10U10 = 67,
D3DDDIFMT_UYVY = MAKEFOURCC('U', 'Y', 'V', 'Y'),
D3DDDIFMT_R8G8_B8G8 = MAKEFOURCC('R', 'G', 'B', 'G'),
D3DDDIFMT_YUY2 = MAKEFOURCC('Y', 'U', 'Y', '2'),
D3DDDIFMT_G8R8_G8B8 = MAKEFOURCC('G', 'R', 'G', 'B'),
D3DDDIFMT_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'),
D3DDDIFMT_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'),
D3DDDIFMT_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'),
D3DDDIFMT_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'),
D3DDDIFMT_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'),
D3DDDIFMT_D16_LOCKABLE = 70,
D3DDDIFMT_D32 = 71,
D3DDDIFMT_D15S1 = 73,
D3DDDIFMT_D24S8 = 75,
D3DDDIFMT_D24X8 = 77,
D3DDDIFMT_D24X4S4 = 79,
D3DDDIFMT_D16 = 80,
D3DDDIFMT_D32F_LOCKABLE = 82,
D3DDDIFMT_D24FS8 = 83,
D3DDDIFMT_D32_LOCKABLE = 84,
D3DDDIFMT_S8_LOCKABLE = 85,
D3DDDIFMT_S1D15 = 72,
D3DDDIFMT_S8D24 = 74,
D3DDDIFMT_X8D24 = 76,
D3DDDIFMT_X4S4D24 = 78,
D3DDDIFMT_L16 = 81,
D3DDDIFMT_VERTEXDATA =100,
D3DDDIFMT_INDEX16 =101,
D3DDDIFMT_INDEX32 =102,
D3DDDIFMT_Q16W16V16U16 =110,
D3DDDIFMT_MULTI2_ARGB8 = MAKEFOURCC('M','E','T','1'),
// Floating point surface formats
// s10e5 formats (16-bits per channel)
D3DDDIFMT_R16F = 111,
D3DDDIFMT_G16R16F = 112,
D3DDDIFMT_A16B16G16R16F = 113,
// IEEE s23e8 formats (32-bits per channel)
D3DDDIFMT_R32F = 114,
D3DDDIFMT_G32R32F = 115,
D3DDDIFMT_A32B32G32R32F = 116,
D3DDDIFMT_CxV8U8 = 117,
// Monochrome 1 bit per pixel format
D3DDDIFMT_A1 = 118,
// 2.8 biased fixed point
D3DDDIFMT_A2B10G10R10_XR_BIAS = 119,
// Decode compressed buffer formats
D3DDDIFMT_DXVACOMPBUFFER_BASE = 150,
D3DDDIFMT_PICTUREPARAMSDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE+0, // 150
D3DDDIFMT_MACROBLOCKDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE+1, // 151
D3DDDIFMT_RESIDUALDIFFERENCEDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE+2, // 152
D3DDDIFMT_DEBLOCKINGDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE+3, // 153
D3DDDIFMT_INVERSEQUANTIZATIONDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE+4, // 154
D3DDDIFMT_SLICECONTROLDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE+5, // 155
D3DDDIFMT_BITSTREAMDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE+6, // 156
D3DDDIFMT_MOTIONVECTORBUFFER = D3DDDIFMT_DXVACOMPBUFFER_BASE+7, // 157
D3DDDIFMT_FILMGRAINBUFFER = D3DDDIFMT_DXVACOMPBUFFER_BASE+8, // 158
D3DDDIFMT_DXVA_RESERVED9 = D3DDDIFMT_DXVACOMPBUFFER_BASE+9, // 159
D3DDDIFMT_DXVA_RESERVED10 = D3DDDIFMT_DXVACOMPBUFFER_BASE+10, // 160
D3DDDIFMT_DXVA_RESERVED11 = D3DDDIFMT_DXVACOMPBUFFER_BASE+11, // 161
D3DDDIFMT_DXVA_RESERVED12 = D3DDDIFMT_DXVACOMPBUFFER_BASE+12, // 162
D3DDDIFMT_DXVA_RESERVED13 = D3DDDIFMT_DXVACOMPBUFFER_BASE+13, // 163
D3DDDIFMT_DXVA_RESERVED14 = D3DDDIFMT_DXVACOMPBUFFER_BASE+14, // 164
D3DDDIFMT_DXVA_RESERVED15 = D3DDDIFMT_DXVACOMPBUFFER_BASE+15, // 165
D3DDDIFMT_DXVA_RESERVED16 = D3DDDIFMT_DXVACOMPBUFFER_BASE+16, // 166
D3DDDIFMT_DXVA_RESERVED17 = D3DDDIFMT_DXVACOMPBUFFER_BASE+17, // 167
D3DDDIFMT_DXVA_RESERVED18 = D3DDDIFMT_DXVACOMPBUFFER_BASE+18, // 168
D3DDDIFMT_DXVA_RESERVED19 = D3DDDIFMT_DXVACOMPBUFFER_BASE+19, // 169
D3DDDIFMT_DXVA_RESERVED20 = D3DDDIFMT_DXVACOMPBUFFER_BASE+20, // 170
D3DDDIFMT_DXVA_RESERVED21 = D3DDDIFMT_DXVACOMPBUFFER_BASE+21, // 171
D3DDDIFMT_DXVA_RESERVED22 = D3DDDIFMT_DXVACOMPBUFFER_BASE+22, // 172
D3DDDIFMT_DXVA_RESERVED23 = D3DDDIFMT_DXVACOMPBUFFER_BASE+23, // 173
D3DDDIFMT_DXVA_RESERVED24 = D3DDDIFMT_DXVACOMPBUFFER_BASE+24, // 174
D3DDDIFMT_DXVA_RESERVED25 = D3DDDIFMT_DXVACOMPBUFFER_BASE+25, // 175
D3DDDIFMT_DXVA_RESERVED26 = D3DDDIFMT_DXVACOMPBUFFER_BASE+26, // 176
D3DDDIFMT_DXVA_RESERVED27 = D3DDDIFMT_DXVACOMPBUFFER_BASE+27, // 177
D3DDDIFMT_DXVA_RESERVED28 = D3DDDIFMT_DXVACOMPBUFFER_BASE+28, // 178
D3DDDIFMT_DXVA_RESERVED29 = D3DDDIFMT_DXVACOMPBUFFER_BASE+29, // 179
D3DDDIFMT_DXVA_RESERVED30 = D3DDDIFMT_DXVACOMPBUFFER_BASE+30, // 180
D3DDDIFMT_DXVA_RESERVED31 = D3DDDIFMT_DXVACOMPBUFFER_BASE+31, // 181
D3DDDIFMT_DXVACOMPBUFFER_MAX = D3DDDIFMT_DXVA_RESERVED31,
D3DDDIFMT_BINARYBUFFER = 199,
D3DDDIFMT_FORCE_UINT =0x7fffffff
} D3DDDIFORMAT;
typedef struct _D3DDDIRECT
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} D3DDDIRECT;
typedef struct _D3DDDI_KERNELOVERLAYINFO
{
D3DKMT_HANDLE hAllocation; // in: Allocation to be displayed
D3DDDIRECT DstRect; // in: Dest rect
D3DDDIRECT SrcRect; // in: Source rect
VOID* pPrivateDriverData; // in: Private driver data
UINT PrivateDriverDataSize; // in: Size of private driver data
} D3DDDI_KERNELOVERLAYINFO;
typedef enum _D3DDDI_GAMMARAMP_TYPE
{
D3DDDI_GAMMARAMP_UNINITIALIZED = 0,
D3DDDI_GAMMARAMP_DEFAULT = 1,
D3DDDI_GAMMARAMP_RGB256x3x16 = 2,
D3DDDI_GAMMARAMP_DXGI_1 = 3,
} D3DDDI_GAMMARAMP_TYPE;
typedef struct _D3DDDI_GAMMA_RAMP_RGB256x3x16
{
USHORT Red[256];
USHORT Green[256];
USHORT Blue[256];
} D3DDDI_GAMMA_RAMP_RGB256x3x16;
typedef struct D3DDDI_DXGI_RGB
{
float Red;
float Green;
float Blue;
} D3DDDI_DXGI_RGB;
typedef struct _D3DDDI_GAMMA_RAMP_DXGI_1
{
D3DDDI_DXGI_RGB Scale;
D3DDDI_DXGI_RGB Offset;
D3DDDI_DXGI_RGB GammaCurve[1025];
} D3DDDI_GAMMA_RAMP_DXGI_1;
// Used as a value for D3DDDI_VIDEO_PRESENT_SOURCE_ID and D3DDDI_VIDEO_PRESENT_TARGET_ID types to specify
// that the respective video present source/target ID hasn't been initialized.
#define D3DDDI_ID_UNINITIALIZED (UINT)(~0)
// TODO:[mmilirud] Define this as (UINT)(~1) to avoid collision with valid source ID equal to 0.
//
// Used as a value for D3DDDI_VIDEO_PRESENT_SOURCE_ID and D3DDDI_VIDEO_PRESENT_TARGET_ID types to specify
// that the respective video present source/target ID isn't applicable for the given execution context.
#define D3DDDI_ID_NOTAPPLICABLE (UINT)(0)
// Used as a value for D3DDDI_VIDEO_PRESENT_SOURCE_ID and D3DDDI_VIDEO_PRESENT_TARGET_ID types to specify
// that the respective video present source/target ID describes every VidPN source/target in question.
#define D3DDDI_ID_ALL (UINT)(~2)
//
// Hardcoded VidPnSource count
//
#define D3DKMDT_MAX_VIDPN_SOURCES_BITCOUNT 4
#define D3DKMDT_MAX_VIDPN_SOURCES (1 << D3DKMDT_MAX_VIDPN_SOURCES_BITCOUNT)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Purpose: Multi-sampling method descriptor type.
//
// Remarks: Driver is free to partition its quality levels for a given multi-sampling method into as many
// increments as it likes, with the condition that each incremental step does noticably improve
// quality of the presented image.
//
typedef struct _D3DDDI_MULTISAMPLINGMETHOD
{
// Number of sub-pixels employed in this multi-sampling method (e.g. 2 for 2x and 8 for 8x multi-sampling)
UINT NumSamples;
// Upper bound on the quality range supported for this multi-sampling method. The range starts from 0
// and goes upto and including the reported maximum quality setting.
UINT NumQualityLevels;
}
D3DDDI_MULTISAMPLINGMETHOD;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Purpose: Video signal scan line ordering descriptor type.
//
// Remarks: Scan-line ordering of the video mode, specifies whether each field contains the entire
// content of a frame, or only half of it (i.e. even/odd lines interchangeably).
// Note that while for standard interlaced modes, what field comes first can be inferred
// from the mode, specifying this characteristic explicitly with an enum both frees up the
// client from having to maintain mode-based look-up tables and is extensible for future
// standard modes not listed in the D3DKMDT_VIDEO_SIGNAL_STANDARD enum.
//
typedef enum _D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING
{
D3DDDI_VSSLO_UNINITIALIZED = 0,
D3DDDI_VSSLO_PROGRESSIVE = 1,
D3DDDI_VSSLO_INTERLACED_UPPERFIELDFIRST = 2,
D3DDDI_VSSLO_INTERLACED_LOWERFIELDFIRST = 3,
D3DDDI_VSSLO_OTHER = 255
}
D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING;
typedef enum D3DDDI_FLIPINTERVAL_TYPE
{
D3DDDI_FLIPINTERVAL_IMMEDIATE = 0,
D3DDDI_FLIPINTERVAL_ONE = 1,
D3DDDI_FLIPINTERVAL_TWO = 2,
D3DDDI_FLIPINTERVAL_THREE = 3,
D3DDDI_FLIPINTERVAL_FOUR = 4,
} D3DDDI_FLIPINTERVAL_TYPE;
typedef enum _D3DDDI_POOL
{
D3DDDIPOOL_SYSTEMMEM = 1,
D3DDDIPOOL_VIDEOMEMORY = 2,
D3DDDIPOOL_LOCALVIDMEM = 3,
D3DDDIPOOL_NONLOCALVIDMEM = 4,
} D3DDDI_POOL;
typedef enum _D3DDDIMULTISAMPLE_TYPE
{
D3DDDIMULTISAMPLE_NONE = 0,
D3DDDIMULTISAMPLE_NONMASKABLE = 1,
D3DDDIMULTISAMPLE_2_SAMPLES = 2,
D3DDDIMULTISAMPLE_3_SAMPLES = 3,
D3DDDIMULTISAMPLE_4_SAMPLES = 4,
D3DDDIMULTISAMPLE_5_SAMPLES = 5,
D3DDDIMULTISAMPLE_6_SAMPLES = 6,
D3DDDIMULTISAMPLE_7_SAMPLES = 7,
D3DDDIMULTISAMPLE_8_SAMPLES = 8,
D3DDDIMULTISAMPLE_9_SAMPLES = 9,
D3DDDIMULTISAMPLE_10_SAMPLES = 10,
D3DDDIMULTISAMPLE_11_SAMPLES = 11,
D3DDDIMULTISAMPLE_12_SAMPLES = 12,
D3DDDIMULTISAMPLE_13_SAMPLES = 13,
D3DDDIMULTISAMPLE_14_SAMPLES = 14,
D3DDDIMULTISAMPLE_15_SAMPLES = 15,
D3DDDIMULTISAMPLE_16_SAMPLES = 16,
D3DDDIMULTISAMPLE_FORCE_UINT = 0x7fffffff
} D3DDDIMULTISAMPLE_TYPE;
typedef struct _D3DDDI_RESOURCEFLAGS
{
union
{
struct
{
UINT RenderTarget : 1; // 0x00000001
UINT ZBuffer : 1; // 0x00000002
UINT Dynamic : 1; // 0x00000004
UINT HintStatic : 1; // 0x00000008
UINT AutogenMipmap : 1; // 0x00000010
UINT DMap : 1; // 0x00000020
UINT WriteOnly : 1; // 0x00000040
UINT NotLockable : 1; // 0x00000080
UINT Points : 1; // 0x00000100
UINT RtPatches : 1; // 0x00000200
UINT NPatches : 1; // 0x00000400
UINT SharedResource : 1; // 0x00000800
UINT DiscardRenderTarget : 1; // 0x00001000
UINT Video : 1; // 0x00002000
UINT CaptureBuffer : 1; // 0x00004000
UINT Primary : 1; // 0x00008000
UINT Texture : 1; // 0x00010000
UINT CubeMap : 1; // 0x00020000
UINT Volume : 1; // 0x00040000
UINT VertexBuffer : 1; // 0x00080000
UINT IndexBuffer : 1; // 0x00100000
UINT DecodeRenderTarget : 1; // 0x00200000
UINT DecodeCompressedBuffer : 1; // 0x00400000
UINT VideoProcessRenderTarget: 1; // 0x00800000
UINT CpuOptimized : 1; // 0x01000000
UINT MightDrawFromLocked : 1; // 0x02000000
UINT Overlay : 1; // 0x04000000
UINT MatchGdiPrimary : 1; // 0x08000000
UINT InterlacedRefresh : 1; // 0x10000000
UINT TextApi : 1; // 0x20000000
UINT RestrictedContent : 1; // 0x40000000
UINT RestrictSharedAccess : 1; // 0x80000000
};
UINT Value;
};
} D3DDDI_RESOURCEFLAGS;
typedef struct _D3DDDI_SURFACEINFO
{
UINT Width; // in: For linear, surface and volume
UINT Height; // in: For surface and volume
UINT Depth; // in: For volume
CONST VOID* pSysMem;
UINT SysMemPitch;
UINT SysMemSlicePitch;
} D3DDDI_SURFACEINFO;
typedef enum _D3DDDI_ROTATION
{
D3DDDI_ROTATION_IDENTITY = 1, // No rotation.
D3DDDI_ROTATION_90 = 2, // Rotated 90 degrees.
D3DDDI_ROTATION_180 = 3, // Rotated 180 degrees.
D3DDDI_ROTATION_270 = 4 // Rotated 270 degrees.
} D3DDDI_ROTATION;
typedef enum D3DDDI_SCANLINEORDERING
{
D3DDDI_SCANLINEORDERING_UNKNOWN = 0,
D3DDDI_SCANLINEORDERING_PROGRESSIVE = 1,
D3DDDI_SCANLINEORDERING_INTERLACED = 2,
} D3DDDI_SCANLINEORDERING;
typedef struct _D3DDDIARG_CREATERESOURCE
{
D3DDDIFORMAT Format;
D3DDDI_POOL Pool;
D3DDDIMULTISAMPLE_TYPE MultisampleType;
UINT MultisampleQuality;
CONST D3DDDI_SURFACEINFO* pSurfList; // in: List of sub resource objects to create
UINT SurfCount; // in: Number of sub resource objects
UINT MipLevels;
UINT Fvf; // in: FVF format for vertex buffers
D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPnSourceId on which the primary surface is created
D3DDDI_RATIONAL RefreshRate; // in: RefreshRate that this primary surface is to be used with
HANDLE hResource; // in/out: D3D runtime handle/UM driver handle
D3DDDI_RESOURCEFLAGS Flags;
D3DDDI_ROTATION Rotation; // in: The orientation of the resource. (0, 90, 180, 270)
} D3DDDIARG_CREATERESOURCE;
typedef struct _D3DDDICB_SIGNALFLAGS
{
union
{
struct
{
UINT SignalAtSubmission : 1;
UINT Reserved : 31;
};
UINT Value;
};
} D3DDDICB_SIGNALFLAGS;
#define D3DDDI_MAX_OBJECT_WAITED_ON 32
#define D3DDDI_MAX_OBJECT_SIGNALED 32
typedef enum _D3DDDI_SYNCHRONIZATIONOBJECT_TYPE
{
D3DDDI_SYNCHRONIZATION_MUTEX = 1,
D3DDDI_SEMAPHORE = 2,
D3DDDI_FENCE = 3,
D3DDDI_CPU_NOTIFICATION = 4,
} D3DDDI_SYNCHRONIZATIONOBJECT_TYPE;
typedef struct _D3DDDI_SYNCHRONIZATIONOBJECTINFO
{
D3DDDI_SYNCHRONIZATIONOBJECT_TYPE Type; // in: Type of synchronization object to create.
union
{
struct
{
BOOL InitialState; // in: Initial state of a synchronization mutex.
} SynchronizationMutex;
struct
{
UINT MaxCount; // in: Max count of the semaphore.
UINT InitialCount; // in: Initial count of the semaphore.
} Semaphore;
struct
{
UINT Reserved[16]; // Reserved for future use.
} Reserved;
};
} D3DDDI_SYNCHRONIZATIONOBJECTINFO;
typedef struct _D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS
{
UINT Shared : 1;
UINT Reserved : 31;
} D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS;
typedef struct _D3DDDI_SYNCHRONIZATIONOBJECTINFO2
{
D3DDDI_SYNCHRONIZATIONOBJECT_TYPE Type; // in: Type of synchronization object to create.
D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS Flags; // in: flags.
union
{
struct
{
BOOL InitialState; // in: Initial state of a synchronization mutex.
} SynchronizationMutex;
struct
{
UINT MaxCount; // in: Max count of the semaphore.
UINT InitialCount; // in: Initial count of the semaphore.
} Semaphore;
struct
{
UINT64 FenceValue; // in: inital fence value.
} Fence;
struct
{
HANDLE Event; // in: Handle to the event
} CPUNotification;
struct
{
UINT64 Reserved[8]; // Reserved for future use.
} Reserved;
};
D3DKMT_HANDLE SharedHandle; // out: global shared handle (when requested to be shared)
} D3DDDI_SYNCHRONIZATIONOBJECTINFO2;
//
// Defines the maximum number of context a particular command buffer can
// be broadcast to.
//
#define D3DDDI_MAX_BROADCAST_CONTEXT 64
//
// Allocation priorities.
//
#define D3DDDI_ALLOCATIONPRIORITY_MINIMUM 0x28000000
#define D3DDDI_ALLOCATIONPRIORITY_LOW 0x50000000
#define D3DDDI_ALLOCATIONPRIORITY_NORMAL 0x78000000
#define D3DDDI_ALLOCATIONPRIORITY_HIGH 0xa0000000
#define D3DDDI_ALLOCATIONPRIORITY_MAXIMUM 0xc8000000
#endif // (NTDDI_VERSION >= NTDDI_LONGHORN) || defined(D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL)
#pragma warning(pop)
#endif /* _D3DUKMDT_H_ */

View File

@ -0,0 +1,256 @@
/******************************************************************
* *
* D3DVec.inl *
* *
* Float-valued 3D vector class for Direct3D. *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
******************************************************************/
#include <math.h>
// =====================================
// Constructors
// =====================================
inline
_D3DVECTOR::_D3DVECTOR(D3DVALUE f)
{
x = y = z = f;
}
inline
_D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
{
x = _x; y = _y; z = _z;
}
inline
_D3DVECTOR::_D3DVECTOR(const D3DVALUE f[3])
{
x = f[0]; y = f[1]; z = f[2];
}
// =====================================
// Access grants
// =====================================
inline const D3DVALUE&
_D3DVECTOR::operator[](int i) const
{
return (&x)[i];
}
inline D3DVALUE&
_D3DVECTOR::operator[](int i)
{
return (&x)[i];
}
// =====================================
// Assignment operators
// =====================================
inline _D3DVECTOR&
_D3DVECTOR::operator += (const _D3DVECTOR& v)
{
x += v.x; y += v.y; z += v.z;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator -= (const _D3DVECTOR& v)
{
x -= v.x; y -= v.y; z -= v.z;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator *= (const _D3DVECTOR& v)
{
x *= v.x; y *= v.y; z *= v.z;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator /= (const _D3DVECTOR& v)
{
x /= v.x; y /= v.y; z /= v.z;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator *= (D3DVALUE s)
{
x *= s; y *= s; z *= s;
return *this;
}
inline _D3DVECTOR&
_D3DVECTOR::operator /= (D3DVALUE s)
{
x /= s; y /= s; z /= s;
return *this;
}
inline _D3DVECTOR
operator + (const _D3DVECTOR& v)
{
return v;
}
inline _D3DVECTOR
operator - (const _D3DVECTOR& v)
{
return _D3DVECTOR(-v.x, -v.y, -v.z);
}
inline _D3DVECTOR
operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
}
inline _D3DVECTOR
operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
}
inline _D3DVECTOR
operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z);
}
inline _D3DVECTOR
operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR(v1.x/v2.x, v1.y/v2.y, v1.z/v2.z);
}
inline int
operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return v1[0] < v2[0] && v1[1] < v2[1] && v1[2] < v2[2];
}
inline int
operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return v1[0] <= v2[0] && v1[1] <= v2[1] && v1[2] <= v2[2];
}
inline _D3DVECTOR
operator * (const _D3DVECTOR& v, D3DVALUE s)
{
return _D3DVECTOR(s*v.x, s*v.y, s*v.z);
}
inline _D3DVECTOR
operator * (D3DVALUE s, const _D3DVECTOR& v)
{
return _D3DVECTOR(s*v.x, s*v.y, s*v.z);
}
inline _D3DVECTOR
operator / (const _D3DVECTOR& v, D3DVALUE s)
{
return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
}
inline int
operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return v1.x==v2.x && v1.y==v2.y && v1.z == v2.z;
}
inline D3DVALUE
Magnitude (const _D3DVECTOR& v)
{
return (D3DVALUE) sqrt(SquareMagnitude(v));
}
inline D3DVALUE
SquareMagnitude (const _D3DVECTOR& v)
{
return v.x*v.x + v.y*v.y + v.z*v.z;
}
inline _D3DVECTOR
Normalize (const _D3DVECTOR& v)
{
return v / Magnitude(v);
}
inline D3DVALUE
Min (const _D3DVECTOR& v)
{
D3DVALUE ret = v.x;
if (v.y < ret) ret = v.y;
if (v.z < ret) ret = v.z;
return ret;
}
inline D3DVALUE
Max (const _D3DVECTOR& v)
{
D3DVALUE ret = v.x;
if (ret < v.y) ret = v.y;
if (ret < v.z) ret = v.z;
return ret;
}
inline _D3DVECTOR
Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR( v1[0] < v2[0] ? v1[0] : v2[0],
v1[1] < v2[1] ? v1[1] : v2[1],
v1[2] < v2[2] ? v1[2] : v2[2]);
}
inline _D3DVECTOR
Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return _D3DVECTOR( v1[0] > v2[0] ? v1[0] : v2[0],
v1[1] > v2[1] ? v1[1] : v2[1],
v1[2] > v2[2] ? v1[2] : v2[2]);
}
inline D3DVALUE
DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
return v1.x*v2.x + v1.y * v2.y + v1.z*v2.z;
}
inline _D3DVECTOR
CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
_D3DVECTOR result;
result[0] = v1[1] * v2[2] - v1[2] * v2[1];
result[1] = v1[2] * v2[0] - v1[0] * v2[2];
result[2] = v1[0] * v2[1] - v1[1] * v2[0];
return result;
}
inline _D3DMATRIX
operator* (const _D3DMATRIX& a, const _D3DMATRIX& b)
{
_D3DMATRIX ret;
for (int i=0; i<4; i++) {
for (int j=0; j<4; j++) {
ret(i, j) = 0.0f;
for (int k=0; k<4; k++) {
ret(i, j) += a(i, k) * b(k, j);
}
}
}
return ret;
}

View File

@ -0,0 +1,155 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
D4drvif.h
Abstract:
DOT4 Driver Interface
--*/
#ifndef _DOT4DRVIF_H
#define _DOT4DRVIF_H
//////////////////////////////////////////////////////////////////////////////
// Includes
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Defines
//////////////////////////////////////////////////////////////////////////////
#define MAX_SERVICE_LENGTH 40
#ifndef CTL_CODE
//
// Macro definition for defining IOCTL and FSCTL function control codes. Note
// that function codes 0-2047 are reserved for Microsoft Corporation, and
// 2048-4095 are reserved for customers.
//
#define CTL_CODE( DeviceType, Function, Method, Access ) ( \
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
)
//
// Define the method codes for how buffers are passed for I/O and FS controls
//
#define METHOD_BUFFERED 0
#define METHOD_IN_DIRECT 1
#define METHOD_OUT_DIRECT 2
#define METHOD_NEITHER 3
//
// Define the access check value for any access
//
//
// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
// constants *MUST* always be in sync.
//
#define FILE_ANY_ACCESS 0
#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe
#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe
#endif
#define FILE_DEVICE_DOT4 0x3a
#define IOCTL_DOT4_USER_BASE 2049
#define IOCTL_DOT4_LAST IOCTL_DOT4_USER_BASE + 9
#define IOCTL_DOT4_CREATE_SOCKET CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 7, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_DOT4_DESTROY_SOCKET CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 9, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_DOT4_WAIT_FOR_CHANNEL CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 8, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_DOT4_OPEN_CHANNEL CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_DOT4_CLOSE_CHANNEL CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DOT4_READ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 2, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_DOT4_WRITE CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 3, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_DOT4_ADD_ACTIVITY_BROADCAST CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DOT4_REMOVE_ACTIVITY_BROADCAST CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DOT4_WAIT_ACTIVITY_BROADCAST CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 6, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
//////////////////////////////////////////////////////////////////////////////
// Types
//////////////////////////////////////////////////////////////////////////////
typedef struct _DOT4_DRIVER_CMD
{
// Handle to channel
CHANNEL_HANDLE hChannelHandle;
// Length of request
ULONG ulSize;
// Offset into buffer
ULONG ulOffset;
// Timeout of operation. Can be INFINITE.
ULONG ulTimeout;
} DOT4_DRIVER_CMD, *PDOT4_DRIVER_CMD;
typedef struct _DOT4_DC_OPEN_DATA
{
// Host socket created by CREATE_SOCKET
unsigned char bHsid;
// TRUE to immediately add activity broadcast upon creation
unsigned char fAddActivity;
// Handle to channel returned
CHANNEL_HANDLE hChannelHandle;
} DOT4_DC_OPEN_DATA, *PDOT4_DC_OPEN_DATA;
typedef struct _DOT4_DC_CREATE_DATA
{
// This or service name sent
unsigned char bPsid;
CHAR pServiceName[MAX_SERVICE_LENGTH + 1];
// Type (stream or packet) of channels on socket
unsigned char bType;
// Size of read buffer for channels on socket
ULONG ulBufferSize;
USHORT usMaxHtoPPacketSize;
USHORT usMaxPtoHPacketSize;
// Host socket id returned
unsigned char bHsid;
} DOT4_DC_CREATE_DATA, *PDOT4_DC_CREATE_DATA;
typedef struct _DOT4_DC_DESTROY_DATA
{
// Host socket created by CREATE_SOCKET
unsigned char bHsid;
} DOT4_DC_DESTROY_DATA, *PDOT4_DC_DESTROY_DATA;
//////////////////////////////////////////////////////////////////////////////
// Prototypes
//////////////////////////////////////////////////////////////////////////////
#endif

View File

@ -0,0 +1,101 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
D4iface.h
Abstract:
DOT4 Interface
--*/
#ifndef _DOT4_IFACE_H
#define _DOT4_IFACE_H
#ifdef __cplusplus
extern "C" {
#endif
//////////////////////////////////////////////////////////////////////////////
// Includes
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Defines
//////////////////////////////////////////////////////////////////////////////
#define DOT4_MAX_CHANNELS 128
#define NO_TIMEOUT 0
//
// DOT4 Channel types
//
#define STREAM_TYPE_CHANNEL 1
#define PACKET_TYPE_CHANNEL 2
//
// DOT4 broadcast Activity messages
//
#define DOT4_STREAM_RECEIVED 0x100
#define DOT4_STREAM_CREDITS 0x101
#define DOT4_MESSAGE_RECEIVED 0x102 // Message is received
#define DOT4_DISCONNECT 0x103 // The link was disconnected
#define DOT4_CHANNEL_CLOSED 0x105 // A channel was closed
//
// DOT4 Channels
//
#define DOT4_CHANNEL 0
#define HP_MESSAGE_PROCESSOR 1
#define PRINTER_CHANNEL 2
// As of revision 3.7 of the DOT4 specification, socket 3 had no assignment
#define SCANNER_CHANNEL 4
#define MIO_COMMAND_PROCESSOR 5
#define ECHO_CHANNEL 6
#define FAX_SEND_CHANNEL 7
#define FAX_RECV_CHANNEL 8
#define DIAGNOSTIC_CHANNEL 9
#define HP_RESERVED 10
#define IMAGE_DOWNLOAD 11
#define HOST_DATASTORE_UPLOAD 12
#define HOST_DATASTORE_DOWNLOAD 13
#define CONFIG_UPLOAD 14
#define CONFIG_DOWNLOAD 15
//////////////////////////////////////////////////////////////////////////////
// Types
//////////////////////////////////////////////////////////////////////////////
typedef unsigned long CHANNEL_HANDLE;
typedef CHANNEL_HANDLE *PCHANNEL_HANDLE;
typedef struct _DOT4_ACTIVITY
{
ULONG ulMessage;
ULONG ulByteCount;
CHANNEL_HANDLE hChannel;
} DOT4_ACTIVITY, *PDOT4_ACTIVITY;
//////////////////////////////////////////////////////////////////////////////
// Prototypes
//////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
// end of extern "C"
}
#endif
#endif // _DOT4_IFACE_H

View File

@ -0,0 +1,288 @@
/*******************************************************************
*
* FILE: dciddi.h
*
* DESCRIPTION: definitions for MS/Intel-defined DCI interface
*
* Copyright (C) 1994-1999 Intel/Microsoft Corporation. All Rights Reserved.
*
*******************************************************************/
#ifndef _INC_DCIDDI
#define _INC_DCIDDI
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* DCI Command Escapes */
#define DCICOMMAND 3075
#define DCI_VERSION 0x0100
#define DCICREATEPRIMARYSURFACE 1
#define DCICREATEOFFSCREENSURFACE 2
#define DCICREATEOVERLAYSURFACE 3
#define DCIENUMSURFACE 4
#define DCIESCAPE 5
/* DCI-Defined error codes */
#define DCI_OK 0 /* success */
/* Hard errors -- DCI will be unavailable */
#define DCI_FAIL_GENERIC -1
#define DCI_FAIL_UNSUPPORTEDVERSION -2
#define DCI_FAIL_INVALIDSURFACE -3
#define DCI_FAIL_UNSUPPORTED -4
/* Soft errors -- DCI may be available later */
#define DCI_ERR_CURRENTLYNOTAVAIL -5
#define DCI_ERR_INVALIDRECT -6
#define DCI_ERR_UNSUPPORTEDFORMAT -7
#define DCI_ERR_UNSUPPORTEDMASK -8
#define DCI_ERR_TOOBIGHEIGHT -9
#define DCI_ERR_TOOBIGWIDTH -10
#define DCI_ERR_TOOBIGSIZE -11
#define DCI_ERR_OUTOFMEMORY -12
#define DCI_ERR_INVALIDPOSITION -13
#define DCI_ERR_INVALIDSTRETCH -14
#define DCI_ERR_INVALIDCLIPLIST -15
#define DCI_ERR_SURFACEISOBSCURED -16
#define DCI_ERR_XALIGN -17
#define DCI_ERR_YALIGN -18
#define DCI_ERR_XYALIGN -19
#define DCI_ERR_WIDTHALIGN -20
#define DCI_ERR_HEIGHTALIGN -21
/* success messages -- DCI call succeeded, but specified item changed */
#define DCI_STATUS_POINTERCHANGED 1
#define DCI_STATUS_STRIDECHANGED 2
#define DCI_STATUS_FORMATCHANGED 4
#define DCI_STATUS_SURFACEINFOCHANGED 8
#define DCI_STATUS_CHROMAKEYCHANGED 16
#define DCI_STATUS_WASSTILLDRAWING 32
#define DCI_SUCCESS(error) (((DCIRVAL)error) >= 0)
/* DCI Capability Flags */
#define DCI_SURFACE_TYPE 0x0000000F
#define DCI_PRIMARY 0x00000000
#define DCI_OFFSCREEN 0x00000001
#define DCI_OVERLAY 0x00000002
#define DCI_VISIBLE 0x00000010
#define DCI_CHROMAKEY 0x00000020
#define DCI_1632_ACCESS 0x00000040
#define DCI_DWORDSIZE 0x00000080
#define DCI_DWORDALIGN 0x00000100
#define DCI_WRITEONLY 0x00000200
#define DCI_ASYNC 0x00000400
#define DCI_CAN_STRETCHX 0x00001000
#define DCI_CAN_STRETCHY 0x00002000
#define DCI_CAN_STRETCHXY (DCI_CAN_STRETCHX | DCI_CAN_STRETCHY)
#define DCI_CAN_STRETCHXN 0x00004000
#define DCI_CAN_STRETCHYN 0x00008000
#define DCI_CAN_STRETCHXYN (DCI_CAN_STRETCHXN | DCI_CAN_STRETCHYN)
#define DCI_CANOVERLAY 0x00010000
/*
* Win32 RGNDATA structure. This will be used for cliplist info. passing.
*/
#if (WINVER < 0x0400)
#ifndef RDH_RECTANGLES
typedef struct tagRECTL
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECTL;
typedef RECTL* PRECTL;
typedef RECTL NEAR* NPRECTL;
typedef RECTL FAR* LPRECTL;
typedef const RECTL FAR* LPCRECTL;
#define RDH_RECTANGLES 0
typedef struct tagRGNDATAHEADER {
DWORD dwSize; /* size of structure */
DWORD iType; /* Will be RDH_RECTANGLES */
DWORD nCount; /* # of clipping rectangles */
DWORD nRgnSize; /* size of buffer -- can be zero */
RECTL rcBound; /* bounding rectangle for region*/
} RGNDATAHEADER;
typedef RGNDATAHEADER* PRGNDATAHEADER;
typedef RGNDATAHEADER NEAR* NPRGNDATAHEADER;
typedef RGNDATAHEADER FAR* LPRGNDATAHEADER;
typedef const RGNDATAHEADER FAR* LPCRGNDATAHEADER;
typedef struct tagRGNDATA {
RGNDATAHEADER rdh;
char Buffer[1];
} RGNDATA;
typedef RGNDATA* PRGNDATA;
typedef RGNDATA NEAR* NPRGNDATA;
typedef RGNDATA FAR* LPRGNDATA;
typedef const RGNDATA FAR* LPCRGNDATA;
#endif
#endif
typedef int DCIRVAL; /* return for callbacks */
/**************************************************************************
* input structures
**************************************************************************/
/*
* Used by a DCI client to provide input parameters for the
* DCICREATEPRIMARYSURFACE escape.
*/
typedef struct _DCICMD {
DWORD dwCommand;
DWORD dwParam1;
DWORD dwParam2;
DWORD dwVersion;
DWORD dwReserved;
} DCICMD;
/*
* This structure is used by a DCI client to provide input parameters for
* the DCICREATE... calls. The fields that are actually relevant differ for
* each of the three calls. Details are in the DCI Spec chapter providing
* the function specifications.
*/
typedef struct _DCICREATEINPUT {
DCICMD cmd; /* common header structure */
DWORD dwCompression; /* format of surface to be created */
DWORD dwMask[3]; /* for nonstandard RGB (e.g. 5-6-5, RGB32) */
DWORD dwWidth; /* height of the surface to be created */
DWORD dwHeight; /* width of input surfaces */
DWORD dwDCICaps; /* capabilities of surface wanted */
DWORD dwBitCount; /* bit depth of format to be created */
LPVOID lpSurface; /* pointer to an associated surface */
} DCICREATEINPUT, FAR *LPDCICREATEINPUT;
/**************************************************************************
* surface info. structures
**************************************************************************/
/*
* This structure is used to return information about available support
* during a DCIEnumSurface call. It is also used to create a primary
* surface, and as a member of the larger structures returned by the
* offscreen and overlay calls.
*/
typedef struct _DCISURFACEINFO {
DWORD dwSize; /* size of structure */
DWORD dwDCICaps; /* capability flags (stretch, etc.) */
DWORD dwCompression; /* format of surface to be created */
DWORD dwMask[3]; /* for BI_BITMASK surfaces */
DWORD dwWidth; /* width of surface */
DWORD dwHeight; /* height of surface */
LONG lStride; /* distance in bytes betw. one pixel */
/* and the pixel directly below it */
DWORD dwBitCount; /* Bits per pixel for this dwCompression */
ULONG_PTR dwOffSurface; /* offset of surface pointer */
WORD wSelSurface; /* selector of surface pointer */
WORD wReserved;
DWORD dwReserved1; /* reserved for provider */
DWORD dwReserved2; /* reserved for DCIMAN */
DWORD dwReserved3; /* reserved for future */
DCIRVAL (CALLBACK *BeginAccess) (LPVOID, LPRECT); /* BeginAccess callback */
void (CALLBACK *EndAccess) (LPVOID); /* EndAcess callback */
void (CALLBACK *DestroySurface) (LPVOID); /* Destroy surface callback */
} DCISURFACEINFO, FAR *LPDCISURFACEINFO;
/*
* This structure is used by a DCI client to provide input parameters for the
* DCIEnumSurface call.
*/
typedef
void
(*ENUM_CALLBACK) (
LPDCISURFACEINFO lpSurfaceInfo,
LPVOID lpContext
);
typedef struct _DCIENUMINPUT {
DCICMD cmd; /* common header structure */
RECT rSrc; /* source rect. for stretch */
RECT rDst; /* dest. rect. for stretch */
void (CALLBACK *EnumCallback)(LPDCISURFACEINFO, LPVOID); /* callback for supported formats */
LPVOID lpContext;
} DCIENUMINPUT, FAR *LPDCIENUMINPUT;
/*
* This structure must be allocated and returned by the DCI provider in
* response to a DCICREATEPRIMARYSURFACE call.
*/
typedef DCISURFACEINFO DCIPRIMARY, FAR *LPDCIPRIMARY;
/*
* This structure must be allocated and returned by the DCI provider in
* response to a DCICREATEOFFSCREENSURFACE call.
*/
typedef struct _DCIOFFSCREEN {
DCISURFACEINFO dciInfo; /* surface info */
DCIRVAL (CALLBACK *Draw) (LPVOID); /* copy to onscreen buffer */
DCIRVAL (CALLBACK *SetClipList) (LPVOID, LPRGNDATA); /* SetCliplist callback */
DCIRVAL (CALLBACK *SetDestination) (LPVOID, LPRECT, LPRECT); /* SetDestination callback */
} DCIOFFSCREEN, FAR *LPDCIOFFSCREEN;
/*
* This structure must be allocated and returned by the DCI provider in response
* to a DCICREATEOVERLAYSURFACE call.
*/
typedef struct _DCIOVERLAY{
DCISURFACEINFO dciInfo; /* surface info */
DWORD dwChromakeyValue; /* chromakey color value */
DWORD dwChromakeyMask; /* specifies valid bits of value */
} DCIOVERLAY, FAR *LPDCIOVERLAY;
/* DCI FOURCC def.s for extended DIB formats */
#ifndef YVU9
#define YVU9 mmioFOURCC('Y','V','U','9')
#endif
#ifndef Y411
#define Y411 mmioFOURCC('Y','4','1','1')
#endif
#ifndef YUY2
#define YUY2 mmioFOURCC('Y','U','Y','2')
#endif
#ifndef YVYU
#define YVYU mmioFOURCC('Y','V','Y','U')
#endif
#ifndef UYVY
#define UYVY mmioFOURCC('U','Y','V','Y')
#endif
#ifndef Y211
#define Y211 mmioFOURCC('Y','2','1','1')
#endif
#ifdef __cplusplus
}
#endif
#endif // _INC_DCIDDI

View File

@ -0,0 +1,156 @@
/****************************************************************************
DCIMAN.H
Copyright (C) 1993-1999 Microsoft Corporation. All Rights Reserved.
DCIMAN 1.0 client interface definitions
***************************************************************************/
#ifndef _INC_DCIMAN
#define _INC_DCIMAN
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef __cplusplus
#define __inline inline
extern "C" {
#endif
/****************************************************************************
***************************************************************************/
#include "dciddi.h" // interface to the DCI provider
/****************************************************************************
***************************************************************************/
DECLARE_HANDLE(HWINWATCH); // context handle for WinWatch instance
/****************************************************************************
***************************************************************************/
extern HDC WINAPI DCIOpenProvider(void);
extern void WINAPI DCICloseProvider(HDC hdc);
extern int WINAPI DCICreatePrimary(HDC hdc, LPDCISURFACEINFO FAR *lplpSurface);
extern int WINAPI DCICreateOffscreen(HDC hdc, DWORD dwCompression, DWORD dwRedMask,
DWORD dwGreenMask, DWORD dwBlueMask, DWORD dwWidth, DWORD dwHeight,
DWORD dwDCICaps, DWORD dwBitCount, LPDCIOFFSCREEN FAR *lplpSurface);
extern int WINAPI DCICreateOverlay(HDC hdc, LPVOID lpOffscreenSurf,
LPDCIOVERLAY FAR *lplpSurface);
extern int WINAPI DCIEnum(HDC hdc, LPRECT lprDst, LPRECT lprSrc, LPVOID lpFnCallback,
LPVOID lpContext);
extern DCIRVAL WINAPI DCISetSrcDestClip(LPDCIOFFSCREEN pdci, LPRECT srcrc,
LPRECT destrc, LPRGNDATA prd );
extern HWINWATCH WINAPI WinWatchOpen(HWND hwnd);
extern void WINAPI WinWatchClose(HWINWATCH hWW);
// API changed to copy region data instead of return pointer to it
extern UINT WINAPI WinWatchGetClipList(HWINWATCH hWW, LPRECT prc,
UINT size, LPRGNDATA prd);
extern BOOL WINAPI WinWatchDidStatusChange(HWINWATCH hWW);
extern DWORD WINAPI GetWindowRegionData(HWND hwnd, DWORD size, LPRGNDATA prd);
extern DWORD WINAPI GetDCRegionData(HDC hdc, DWORD size, LPRGNDATA prd);
#define WINWATCHNOTIFY_START 0
#define WINWATCHNOTIFY_STOP 1
#define WINWATCHNOTIFY_DESTROY 2
#define WINWATCHNOTIFY_CHANGING 3
#define WINWATCHNOTIFY_CHANGED 4
typedef void (CALLBACK *WINWATCHNOTIFYPROC)(HWINWATCH hww, HWND hwnd, DWORD code, LPARAM lParam);
extern BOOL WINAPI WinWatchNotify(HWINWATCH hWW, WINWATCHNOTIFYPROC NotifyCallback,
LPARAM NotifyParam );
#ifdef WIN32
/****************************************************************************
helper functions to call DCIMAN16.DLL
***************************************************************************/
extern void WINAPI DCIEndAccess(LPDCISURFACEINFO pdci);
extern DCIRVAL WINAPI DCIBeginAccess(LPDCISURFACEINFO pdci, int x, int y, int dx, int dy);
extern void WINAPI DCIDestroy(LPDCISURFACEINFO pdci);
extern DCIRVAL WINAPI DCIDraw(LPDCIOFFSCREEN pdci);
extern DCIRVAL WINAPI DCISetClipList(LPDCIOFFSCREEN pdci, LPRGNDATA prd);
extern DCIRVAL WINAPI DCISetDestination(LPDCIOFFSCREEN pdci, LPRECT dst, LPRECT src);
#else
extern int WINAPI DCISendCommand(HDC hdc, VOID FAR *pcmd, int nSize, VOID FAR * FAR * lplpOut);
/****************************************************************************
helper macros to call DCI callbacks
***************************************************************************/
__inline void DCIDestroy(LPDCISURFACEINFO pdci)
{
if( pdci->DestroySurface != NULL ) {
pdci->DestroySurface(pdci);
}
}
__inline void DCIEndAccess(LPDCISURFACEINFO pdci)
{
if( pdci->EndAccess != NULL ) {
pdci->EndAccess(pdci);
}
}
__inline DCIRVAL DCIBeginAccess(LPDCISURFACEINFO pdci, int x, int y, int dx, int dy)
{
RECT rc;
if( pdci->BeginAccess != NULL ) {
rc.left=x;
rc.top=y;
rc.right = rc.left+dx;
rc.bottom = rc.top+dy;
return pdci->BeginAccess(pdci, &rc);
} else {
return DCI_OK;
}
}
__inline DCIRVAL DCIDraw(LPDCIOFFSCREEN pdci)
{
if( pdci->Draw != NULL ) {
return pdci->Draw(pdci);
} else {
return DCI_OK;
}
}
__inline DCIRVAL DCISetClipList(LPDCIOFFSCREEN pdci, LPRGNDATA prd)
{
if( pdci->SetClipList != NULL ) {
return pdci->SetClipList(pdci, prd);
} else {
return DCI_OK;
}
}
__inline DCIRVAL DCISetDestination(LPDCIOFFSCREEN pdci, LPRECT dst, LPRECT src)
{
if( pdci->SetDestination != NULL ) {
return pdci->SetDestination(pdci, dst, src);
} else {
return DCI_OK;
}
}
#endif
/****************************************************************************
***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif // _INC_DCIMAN

View File

@ -0,0 +1,47 @@
/*++ BUILD Version: ???? Increment this if a change has global effects
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
dderror.h
Abstract:
This module defines the 32-Bit Windows error codes that are useable by
portable kernel drivers.
Revision History:
--*/
#ifndef _DDERROR_
#define _DDERROR_
/*
* This file is a subset of Win32 error codes. Other win32 error codes
* are not supported by portable drivers and should not beused.
* This #define removes the definitions of all other error codes.
*/
#define _WINERROR_
#define NO_ERROR 0L
#define ERROR_INVALID_FUNCTION 1L
#define ERROR_NOT_ENOUGH_MEMORY 8L
#define ERROR_DEV_NOT_EXIST 55L
#define ERROR_INVALID_PARAMETER 87L
#define ERROR_INSUFFICIENT_BUFFER 122L
#define ERROR_INVALID_NAME 123L
#define ERROR_BUSY 170L
#define ERROR_MORE_DATA 234L
#define WAIT_TIMEOUT 258L
#define ERROR_IO_PENDING 997L
#define ERROR_DEVICE_REINITIALIZATION_NEEDED 1164L
#define ERROR_CONTINUE 1246L
#define ERROR_NO_MORE_DEVICES 1248L
#endif /* _DDERROR_ */

View File

@ -0,0 +1,80 @@
/*
* DeviceServices.h
*
* Contains definitions for the core Device Services platform
*
* Copyright (c) Microsoft Corporation, All Rights Reserved.
*
*/
#ifndef _DEVICESERVICES_H_
#define _DEVICESERVICES_H_
#include "BridgeDeviceService.h"
/*****************************************************************************/
/* Service Info */
/*****************************************************************************/
/* Service Info Version
*/
#define DEVSVC_SERVICEINFO_VERSION 0x00000064
/* Service Flags
*/
#define DEVSVCTYPE_DEFAULT 0x00000000
#define DEVSVCTYPE_ABSTRACT 0x00000001
/*****************************************************************************/
/* Common Service Properties */
/*****************************************************************************/
DEFINE_DEVSVCGUID(NAMESPACE_Services,
0x14fa7268, 0x0b6c, 0x4214, 0x94, 0x87, 0x43, 0x5b, 0x48, 0x0a, 0x8c, 0x4f);
/* PKEY_Services_ServiceDisplayName
*
* Type: String
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_Services_ServiceDisplayName,
0x14fa7268, 0x0b6c, 0x4214, 0x94, 0x87, 0x43, 0x5b, 0x48, 0x0a, 0x8c, 0x4f,
2);
#define NAME_Services_ServiceDisplayName L"ServiceDisplayName"
/* PKEY_Services_ServiceIcon
*
* Type: AUInt8
* Form: ByteArray
*/
DEFINE_DEVSVCPROPKEY(PKEY_Services_ServiceIcon,
0x14fa7268, 0x0b6c, 0x4214, 0x94, 0x87, 0x43, 0x5b, 0x48, 0x0a, 0x8c, 0x4f,
3);
#define NAME_Services_ServiceIcon L"ServiceIcon"
/* PKEY_Services_ServiceLocale
*
* Contains the RFC4646 compliant language string for data in this service
*
* Type: String
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_Services_ServiceLocale,
0x14fa7268, 0x0b6c, 0x4214, 0x94, 0x87, 0x43, 0x5b, 0x48, 0x0a, 0x8c, 0x4f,
4);
#define NAME_Services_ServiceLocale L"ServiceLocale"
#endif /* _DEVICESERVICES_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,449 @@
/***************************************************************************
* *
* DMusicKS.h -- This module defines the the DirectMusic WDM interface. *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
***************************************************************************/
#ifndef _DMUSICKS_
#define _DMUSICKS_
#include <dmusprop.h>
#define DONT_HOLD_FOR_SEQUENCING 0x8000000000000000
typedef struct _DMUS_KERNEL_EVENT
{ // this offset
BYTE bReserved; // 1 0
BYTE cbStruct; // 1 1
USHORT cbEvent; // 2 2
USHORT usChannelGroup; // 2 4
USHORT usFlags; // 2 6
REFERENCE_TIME ullPresTime100ns; // 8 8
ULONGLONG ullBytePosition; // 8 16
_DMUS_KERNEL_EVENT *pNextEvt; // 4 (8) 24
union
{
BYTE abData[sizeof(PBYTE)]; // 4 (8) 28 (32)
PBYTE pbData;
_DMUS_KERNEL_EVENT *pPackageEvt;
} uData;
} DMUS_KERNEL_EVENT, *PDMUS_KERNEL_EVENT; // 32 (40)
#define DMUS_KEF_EVENT_COMPLETE 0x0000
#define DMUS_KEF_EVENT_INCOMPLETE 0x0001 // This event is an incomplete package or sysex.
// Do not use this data.
#define DMUS_KEF_PACKAGE_EVENT 0x0002 // This event is a package. The uData.pPackageEvt
// field contains a pointer to a chain of events.
#define kBytePositionNone (~(ULONGLONG)0) // This message has no meaningful byte position
#define SHORT_EVT(evt) ((evt)->cbEvent <= sizeof(PBYTE))
#define PACKAGE_EVT(evt) ((evt)->usFlags & DMUS_KEF_PACKAGE_EVENT)
#define INCOMPLETE_EVT(evt) ((evt)->usFlags & DMUS_KEF_EVENT_INCOMPLETE)
#define COMPLETE_EVT(evt) (((evt)->usFlags & DMUS_KEF_EVENT_INCOMPLETE) == 0)
#define SET_INCOMPLETE_EVT(evt) ((evt)->usFlags |= DMUS_KEF_EVENT_INCOMPLETE)
#define SET_COMPLETE_EVT(evt) ((evt)->usFlags &= (~DMUS_KEF_EVENT_INCOMPLETE))
#define SET_PACKAGE_EVT(evt) ((evt)->usFlags |= DMUS_KEF_PACKAGE_EVENT)
#define CLEAR_PACKAGE_EVT(evt) ((evt)->usFlags &= (~DMUS_KEF_PACKAGE_EVENT))
#define STATIC_CLSID_PortDMus\
0xb7902fe9, 0xfb0a, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
DEFINE_GUIDSTRUCT("b7902fe9-fb0a-11d1-81b0-0060083316c1", CLSID_PortDMus);
#define CLSID_PortDMus DEFINE_GUIDNAMED(CLSID_PortDMus)
#define STATIC_CLSID_MiniportDriverDMusUART\
0xd3f0ce1c, 0xfffc, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
DEFINE_GUIDSTRUCT("d3f0ce1c-fffc-11d1-81b0-0060083316c1", CLSID_MiniportDriverDMusUART);
#define CLSID_MiniportDriverDMusUART DEFINE_GUIDNAMED(CLSID_MiniportDriverDMusUART)
#define STATIC_CLSID_MiniportDriverDMusUARTCapture\
0xd3f0ce1d, 0xfffc, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
DEFINE_GUIDSTRUCT("d3f0ce1d-fffc-11d1-81b0-0060083316c1", CLSID_MiniportDriverDMusUARTCapture);
#define CLSID_MiniportDriverDMusUARTCapture DEFINE_GUIDNAMED(CLSID_MiniportDriverDMusUARTCapture)
#define STATIC_IID_IPortDMus\
0xc096df9c, 0xfb09, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
DEFINE_GUIDSTRUCT("c096df9c-fb09-11d1-81b0-0060083316c1", IID_IPortDMus);
#define IID_IPortDMus DEFINE_GUIDNAMED(IID_IPortDMus)
#define STATIC_IID_IMiniportDMus\
0xc096df9d, 0xfb09, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
DEFINE_GUIDSTRUCT("c096df9d-fb09-11d1-81b0-0060083316c1", IID_IMiniportDMus);
#define IID_IMiniportDMus DEFINE_GUIDNAMED(IID_IMiniportDMus)
#define STATIC_IID_IMXF\
0xc096df9e, 0xfb09, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
DEFINE_GUIDSTRUCT("c096df9e-fb09-11d1-81b0-0060083316c1", IID_IMXF);
#define IID_IMXF DEFINE_GUIDNAMED(IID_IMXF)
#define STATIC_IID_IAllocatorMXF\
0xa5f0d62c, 0xb30f, 0x11d2, 0xb7, 0xa3, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
DEFINE_GUIDSTRUCT("a5f0d62c-b30f-11d2-b7a3-0060083316c1", IID_IAllocatorMXF);
#define IID_IAllocatorMXF DEFINE_GUIDNAMED(IID_IAllocatorMXF)
#define STATIC_IID_ISynthSinkDMus\
0x1f476974, 0x679b, 0x11d2, 0x8f, 0x7d, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef
DEFINE_GUIDSTRUCT("1f476974-679b-11d2-8f7d-00c04fbf8fef", IID_ISynthSinkDMus);
#define IID_ISynthSinkDMus DEFINE_GUIDNAMED(IID_ISynthSinkDMus)
#define STATIC_KSAUDFNAME_DMUSIC_MPU_OUT\
0xA4DF0EB5, 0xBAC9, 0x11d2, 0xB7, 0xA8, 0x00, 0x60, 0x08, 0x33, 0x16, 0xC1
DEFINE_GUIDSTRUCT("A4DF0EB5-BAC9-11d2-B7A8-0060083316C1", KSAUDFNAME_DMUSIC_MPU_OUT);
#define KSAUDFNAME_DMUSIC_MPU_OUT DEFINE_GUIDNAMED(KSAUDFNAME_DMUSIC_MPU_OUT)
#define STATIC_KSAUDFNAME_DMUSIC_MPU_IN\
0xB2EC0A7D, 0xBAC9, 0x11d2, 0xB7, 0xA8, 0x00, 0x60, 0x08, 0x33, 0x16, 0xC1
DEFINE_GUIDSTRUCT("B2EC0A7D-BAC9-11d2-B7A8-0060083316C1", KSAUDFNAME_DMUSIC_MPU_IN);
#define KSAUDFNAME_DMUSIC_MPU_IN DEFINE_GUIDNAMED(KSAUDFNAME_DMUSIC_MPU_IN)
/*****************************************************************************
* IPortDMus
*****************************************************************************
* Interface for DMusic port lower edge.
*/
DECLARE_INTERFACE_(IPortDMus,IPort)
{
DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
DEFINE_ABSTRACT_PORT() // For IPort
// For IPortDMus
STDMETHOD_(void,Notify)
( THIS_
__in_opt PSERVICEGROUP ServiceGroup
) PURE;
STDMETHOD_(void,RegisterServiceGroup)
( THIS_
__in PSERVICEGROUP ServiceGroup
) PURE;
};
typedef IPortDMus *PPORTDMUS;
#ifdef PC_IMPLEMENTATION
#define IMP_IPortDMus\
IMP_IPort;\
STDMETHODIMP_(void) Notify\
( __in_opt PSERVICEGROUP ServiceGroup\
);\
STDMETHODIMP_(void) RegisterServiceGroup\
( __in PSERVICEGROUP ServiceGroup\
)
#endif /* PC_IMPLEMENTATION */
/*****************************************************************************
* IMXF
*****************************************************************************
* Interface for DMusic miniport streams.
*/
struct IMXF;
typedef IMXF *PMXF;
#if !defined(DEFINE_ABSTRACT_MXF)
#define DEFINE_ABSTRACT_MXF() \
STDMETHOD_(NTSTATUS,SetState) \
( THIS_ \
__in KSSTATE State \
) PURE; \
STDMETHOD_(NTSTATUS,PutMessage) \
( THIS_ \
__in PDMUS_KERNEL_EVENT pDMKEvt \
) PURE; \
STDMETHOD_(NTSTATUS,ConnectOutput) \
( THIS_ \
__in PMXF sinkMXF \
) PURE; \
STDMETHOD_(NTSTATUS,DisconnectOutput) \
( THIS_ \
__in PMXF sinkMXF \
) PURE;
#endif //!defined(DEFINE_ABSTRACT_MXF)
DECLARE_INTERFACE_(IMXF,IUnknown)
{
DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
DEFINE_ABSTRACT_MXF() // For IMXF
};
#define IMP_IMXF\
STDMETHODIMP_(NTSTATUS) SetState\
( __in KSSTATE State\
);\
STDMETHODIMP_(NTSTATUS) PutMessage\
( __in PDMUS_KERNEL_EVENT pDMKEvt\
);\
STDMETHODIMP_(NTSTATUS) ConnectOutput\
( __in PMXF sinkMXF\
);\
STDMETHODIMP_(NTSTATUS) DisconnectOutput\
( __in PMXF sinkMXF\
);\
/*****************************************************************************
* IAllocatorMXF
*****************************************************************************
* Interface for DMusic miniport streams.
*/
struct IAllocatorMXF;
typedef IAllocatorMXF *PAllocatorMXF;
DECLARE_INTERFACE_(IAllocatorMXF,IMXF)
{
DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
DEFINE_ABSTRACT_MXF() // For IMXF
// For IAllocatorMXF
STDMETHOD_(NTSTATUS,GetMessage)
( THIS_
__out PDMUS_KERNEL_EVENT * ppDMKEvt
) PURE;
STDMETHOD_(USHORT,GetBufferSize)
( THIS
) PURE;
STDMETHOD_(NTSTATUS,GetBuffer)
( THIS_
__out PBYTE * ppBuffer
) PURE;
STDMETHOD_(NTSTATUS,PutBuffer)
( THIS_
__in PBYTE pBuffer
) PURE;
};
#define IMP_IAllocatorMXF\
IMP_IMXF;\
STDMETHODIMP_(NTSTATUS) GetMessage\
( __out PDMUS_KERNEL_EVENT * ppDMKEvt\
);\
STDMETHODIMP_(USHORT) GetBufferSize\
( void\
);\
STDMETHODIMP_(NTSTATUS) GetBuffer\
( __out PBYTE * ppBuffer\
);\
STDMETHODIMP_(NTSTATUS) PutBuffer\
( __in PBYTE pBuffer\
);\
typedef enum
{
DMUS_STREAM_MIDI_INVALID = -1,
DMUS_STREAM_MIDI_RENDER = 0,
DMUS_STREAM_MIDI_CAPTURE,
DMUS_STREAM_WAVE_SINK
} DMUS_STREAM_TYPE;
/*****************************************************************************
* ISynthSinkDMus
*****************************************************************************
* Interface for synth wave out.
*/
DECLARE_INTERFACE_(ISynthSinkDMus,IMXF)
{
DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
DEFINE_ABSTRACT_MXF() // For IMXF
// For ISynthSinkDMus
STDMETHOD_(void,Render)
( THIS_
__in PBYTE pBuffer,
__in DWORD dwLength,
__in LONGLONG llPosition
) PURE;
STDMETHOD_(NTSTATUS,SyncToMaster)
( THIS_
__in REFERENCE_TIME rfTime,
__in BOOL fStart
) PURE;
STDMETHOD_(NTSTATUS,SampleToRefTime)
( THIS_
__in LONGLONG llSampleTime,
__out REFERENCE_TIME * prfTime
) PURE;
STDMETHOD_(NTSTATUS,RefTimeToSample)
( THIS_
__in REFERENCE_TIME rfTime,
__out LONGLONG * pllSampleTime
) PURE;
};
typedef ISynthSinkDMus * PSYNTHSINKDMUS;
#define IMP_ISynthSinkDMus\
IMP_IMXF;\
STDMETHODIMP_(void) Render\
( __in PBYTE pBuffer,\
__in DWORD dwLength,\
__in LONGLONG llPosition\
);\
STDMETHODIMP_(NTSTATUS) SyncToMaster\
( __in REFERENCE_TIME rfTime,\
__in BOOL fStart\
);\
STDMETHODIMP_(NTSTATUS) SampleToRefTime\
( __in LONGLONG llSampleTime,\
__out REFERENCE_TIME * prfTime\
);\
STDMETHODIMP_(NTSTATUS) RefTimeToSample\
( __in REFERENCE_TIME rfTime,\
__out LONGLONG * pllSampleTime\
)
/*****************************************************************************
* IMasterClock
*****************************************************************************
* Master clock for MXF graph
*/
DECLARE_INTERFACE_(IMasterClock,IUnknown)
{
DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
STDMETHOD_(NTSTATUS,GetTime)
( THIS_
__out REFERENCE_TIME * pTime
) PURE;
};
typedef IMasterClock *PMASTERCLOCK;
#define IMP_IMasterClock \
STDMETHODIMP_(NTSTATUS) GetTime \
( THIS_ \
__out REFERENCE_TIME * pTime \
); \
#if (NTDDI_VERSION < NTDDI_WINXP)
/*****************************************************************************
* IPositionNotify
*****************************************************************************
* Byte position notify for MXF graph
*/
DECLARE_INTERFACE_(IPositionNotify,IUnknown)
{
STDMETHOD_(void,PositionNotify)
( THIS_
__in ULONGLONG bytePosition
) PURE;
};
typedef IPositionNotify *PPOSITIONNOTIFY;
#define IMP_IPositionNotify \
STDMETHODIMP_(void) PositionNotify \
( THIS_ \
__in ULONGLONG bytePosition \
); \
#endif
/*****************************************************************************
* IMiniportDMus
*****************************************************************************
* Interface for DMusic miniports.
*/
DECLARE_INTERFACE_(IMiniportDMus,IMiniport)
{
DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
DEFINE_ABSTRACT_MINIPORT() // For IMiniport
// For IMiniportDMus
STDMETHOD_(NTSTATUS,Init)
( THIS_
__in_opt PUNKNOWN UnknownAdapter,
__in PRESOURCELIST ResourceList,
__in PPORTDMUS Port,
__out PSERVICEGROUP * ServiceGroup
) PURE;
STDMETHOD_(void,Service)
( THIS
) PURE;
STDMETHOD_(NTSTATUS,NewStream)
( THIS_
__out PMXF * MXF,
__in_opt PUNKNOWN OuterUnknown,
__in POOL_TYPE PoolType,
__in ULONG PinID,
__in DMUS_STREAM_TYPE StreamType,
__in PKSDATAFORMAT DataFormat,
__out PSERVICEGROUP * ServiceGroup,
__in PAllocatorMXF AllocatorMXF,
__in PMASTERCLOCK MasterClock,
__out PULONGLONG SchedulePreFetch
) PURE;
};
typedef IMiniportDMus *PMINIPORTDMUS;
#define IMP_IMiniportDMus\
IMP_IMiniport;\
STDMETHODIMP_(NTSTATUS) Init\
( __in_opt PUNKNOWN UnknownAdapter,\
__in PRESOURCELIST ResourceList,\
__in PPORTDMUS Port,\
__out PSERVICEGROUP * ServiceGroup\
);\
STDMETHODIMP_(void) Service\
( void\
);\
STDMETHODIMP_(NTSTATUS) NewStream\
( __out PMXF * MXF, \
__in_opt PUNKNOWN OuterUnknown OPTIONAL, \
__in POOL_TYPE PoolType, \
__in ULONG PinID, \
__in DMUS_STREAM_TYPE StreamType, \
__in PKSDATAFORMAT DataFormat, \
__out PSERVICEGROUP * ServiceGroup, \
__in PAllocatorMXF AllocatorMXF, \
__in PMASTERCLOCK MasterClock, \
__out PULONGLONG SchedulePreFetch \
);
DEFINE_GUID(GUID_DMUS_PROP_GM_Hardware, 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
DEFINE_GUID(GUID_DMUS_PROP_GS_Hardware, 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
DEFINE_GUID(GUID_DMUS_PROP_XG_Hardware, 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
DEFINE_GUID(GUID_DMUS_PROP_XG_Capable, 0x6496aba1, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6);
DEFINE_GUID(GUID_DMUS_PROP_GS_Capable, 0x6496aba2, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6);
DEFINE_GUID(GUID_DMUS_PROP_DLS1, 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
DEFINE_GUID(GUID_DMUS_PROP_WavesReverb, 0x04cb5622, 0x32e5, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6);
DEFINE_GUID(GUID_DMUS_PROP_Effects, 0xcda8d611, 0x684a, 0x11d2, 0x87, 0x1e, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd);
#ifndef DMUS_EFFECT_NONE
#define DMUS_EFFECT_NONE 0x00000000
#endif
#ifndef DMUS_EFFECT_REVERB
#define DMUS_EFFECT_REVERB 0x00000001
#endif
#ifndef DMUS_EFFECT_CHORUS
#define DMUS_EFFECT_CHORUS 0x00000002
#endif
#endif /* _DMUSICKS_ */

View File

@ -0,0 +1,207 @@
/************************************************************************
* *
* dmusics.h -- Definitions for created a DirectMusic software synth *
* *
* Copyright (c) Microsoft Corporation. All rights reserved. *
* *
************************************************************************/
#ifndef _DMUSICS_
#define _DMUSICS_
#include "dmusicc.h"
/* Software synths are enumerated from under this registry key.
*/
#define REGSTR_PATH_SOFTWARESYNTHS "Software\\Microsoft\\DirectMusic\\SoftwareSynths"
interface IDirectMusicSynth;
interface IDirectMusicSynthSink;
#ifndef __cplusplus
typedef interface IDirectMusicSynth IDirectMusicSynth;
typedef interface IDirectMusicSynthSink IDirectMusicSynthSink;
#endif
#if (NTDDI_VERSION >= NTDDI_WINXP) /* Windows XP or greater */
#ifndef _DMUS_VOICE_STATE_DEFINED
#define _DMUS_VOICE_STATE_DEFINED
typedef struct _DMUS_VOICE_STATE
{
BOOL bExists;
SAMPLE_POSITION spPosition;
} DMUS_VOICE_STATE;
#endif /* _DMUS_VOICE_STATE_DEFINED */
/* IDirectMusicSynth::Refresh
*
* This is the last buffer of the stream. It may be a partial block.
*/
#define REFRESH_F_LASTBUFFER 0x00000001
#endif /* NTDDI_VERSION >= NTDDI_WINXP */
#undef INTERFACE
#define INTERFACE IDirectMusicSynth
DECLARE_INTERFACE_(IDirectMusicSynth, IUnknown)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectMusicSynth */
STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
STDMETHOD(Close) (THIS) PURE;
STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE;
STDMETHOD(Download) (THIS_ LPHANDLE phDownload,
LPVOID pvData,
LPBOOL pbFree ) PURE;
STDMETHOD(Unload) (THIS_ HANDLE hDownload,
HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE),
HANDLE hUserData ) PURE;
STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt,
LPBYTE pbBuffer,
DWORD cbBuffer) PURE;
STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
STDMETHOD(SetSynthSink) (THIS_ IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(Render) (THIS_ short *pBuffer,
DWORD dwLength,
LONGLONG llPosition) PURE;
STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup,
DWORD dwChannel,
DWORD dwPriority) PURE;
STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup,
DWORD dwChannel,
LPDWORD pdwPriority) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx,
LPDWORD pdwWaveFormatExSize) PURE;
STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE;
};
#if (NTDDI_VERSION >= NTDDI_WINXP) /* Windows XP or greater */
#undef INTERFACE
#define INTERFACE IDirectMusicSynth8
DECLARE_INTERFACE_(IDirectMusicSynth8, IDirectMusicSynth)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectMusicSynth */
STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
STDMETHOD(Close) (THIS) PURE;
STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE;
STDMETHOD(Download) (THIS_ LPHANDLE phDownload,
LPVOID pvData,
LPBOOL pbFree ) PURE;
STDMETHOD(Unload) (THIS_ HANDLE hDownload,
HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE),
HANDLE hUserData ) PURE;
STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt,
LPBYTE pbBuffer,
DWORD cbBuffer) PURE;
STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
STDMETHOD(SetSynthSink) (THIS_ IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(Render) (THIS_ short *pBuffer,
DWORD dwLength,
LONGLONG llPosition) PURE;
STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup,
DWORD dwChannel,
DWORD dwPriority) PURE;
STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup,
DWORD dwChannel,
LPDWORD pdwPriority) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx,
LPDWORD pdwWaveFormatExSize) PURE;
STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE;
/* IDirectMusicSynth8 */
STDMETHOD(PlayVoice) (THIS_ REFERENCE_TIME rt,
DWORD dwVoiceId,
DWORD dwChannelGroup,
DWORD dwChannel,
DWORD dwDLId,
long prPitch, /* PREL not defined here */
long vrVolume, /* VREL not defined here */
SAMPLE_TIME stVoiceStart,
SAMPLE_TIME stLoopStart,
SAMPLE_TIME stLoopEnd) PURE;
STDMETHOD(StopVoice) (THIS_ REFERENCE_TIME rt,
DWORD dwVoiceId ) PURE;
STDMETHOD(GetVoiceState) (THIS_ DWORD dwVoice[],
DWORD cbVoice,
DMUS_VOICE_STATE dwVoiceState[] ) PURE;
STDMETHOD(Refresh) (THIS_ DWORD dwDownloadID,
DWORD dwFlags) PURE;
STDMETHOD(AssignChannelToBuses) (THIS_ DWORD dwChannelGroup,
DWORD dwChannel,
LPDWORD pdwBuses,
DWORD cBuses) PURE;
};
#endif /* NTDDI_VERSION >= NTDDI_WINXP */
#undef INTERFACE
#define INTERFACE IDirectMusicSynthSink
DECLARE_INTERFACE_(IDirectMusicSynthSink, IUnknown)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* IDirectMusicSynthSink */
STDMETHOD(Init) (THIS_ IDirectMusicSynth *pSynth) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
STDMETHOD(SampleToRefTime) (THIS_ LONGLONG llSampleTime,
REFERENCE_TIME *prfTime) PURE;
STDMETHOD(RefTimeToSample) (THIS_ REFERENCE_TIME rfTime,
LONGLONG *pllSampleTime) PURE;
STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound,
LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE;
STDMETHOD(GetDesiredBufferSize) (THIS_ LPDWORD pdwBufferSizeInSamples) PURE;
};
DEFINE_GUID(IID_IDirectMusicSynth, 0x9823661, 0x5c85, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
DEFINE_GUID(IID_IDirectMusicSynthSink,0x9823663, 0x5c85, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
#if (NTDDI_VERSION >= NTDDI_WINXP) /* Windows XP or greater */
DEFINE_GUID(IID_IDirectMusicSynth8,0x53cab625, 0x2711, 0x4c9f, 0x9d, 0xe7, 0x1b, 0x7f, 0x92, 0x5f, 0x6f, 0xc8);
#else
DEFINE_GUID(CLSID_DirectMusicSynthSink,0xaec17ce3, 0xa514, 0x11d1, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
#endif
/* Property Set GUID_DMUS_PROP_SetSynthSink
*
* Item 0: An IUnknown on which the port can QueryInterface for a user-mode synth sink.
*/
DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink,0x0a3a5ba5, 0x37b6, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
/* Property Set GUID_DMUS_PROP_SinkUsesDSound
*
* Item 0: A DWORD boolean indicating whether or not the sink requires an IDirectSound interface. The
* default is FALSE if this property item is not implemented by the sink.
*/
DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound, 0xbe208857, 0x8952, 0x11d2, 0xba, 0x1c, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
#endif

View File

@ -0,0 +1,263 @@
/***************************************************************************
* *
* DMusProp.h -- This module defines property items for DirectMusic WDM *
* *
* Copyright (c) 1998, Microsoft Corp. All rights reserved. *
* *
***************************************************************************/
#ifndef _DMusProp_
#define _DMusProp_
#include "dmusbuff.h"
/*
Formats
*/
#define STATIC_KSDATAFORMAT_SUBTYPE_DIRECTMUSIC\
0x1a82f8bc, 0x3f8b, 0x11d2, 0xb7, 0x74, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
DEFINE_GUIDSTRUCT("1a82f8bc-3f8b-11d2-b774-0060083316c1", KSDATAFORMAT_SUBTYPE_DIRECTMUSIC);
#define KSDATAFORMAT_SUBTYPE_DIRECTMUSIC DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DIRECTMUSIC)
/*
Topology
*/
#define STATIC_KSNODETYPE_DMSYNTH\
0x94824f88, 0x6183, 0x11d2, 0x8f, 0x7a, 0x0, 0xc0, 0x4f, 0xbf, 0x8f, 0xef
DEFINE_GUIDSTRUCT("94824F88-6183-11d2-8F7A-00C04FBF8FEF", KSNODETYPE_DMSYNTH);
#define KSNODETYPE_DMSYNTH DEFINE_GUIDNAMED(KSNODETYPE_DMSYNTH)
/*
Caps node (per pin)
*/
#define STATIC_KSNODETYPE_DMSYNTH_CAPS\
0xbca2a2f1, 0x93c6, 0x11d2, 0xba, 0x1d, 0x0, 0x0, 0xf8, 0x75, 0xac, 0x12
DEFINE_GUIDSTRUCT("bca2a2f1-93c6-11d2-ba1d-0000f875ac12", KSNODETYPE_DMSYNTH_CAPS);
#define KSNODETYPE_DMSYNTH_CAPS DEFINE_GUIDNAMED(KSNODETYPE_DMSYNTH_CAPS)
/*
DDK Property sets and items
*/
#define STATIC_KSPROPSETID_Synth_Dls\
0xd523fa2c, 0xdee3, 0x11d1, 0xa7, 0x89, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12
DEFINE_GUIDSTRUCT("d523fa2c-dee3-11d1-a789-0000f875ac12", KSPROPSETID_Synth_Dls);
#define KSPROPSETID_Synth_Dls DEFINE_GUIDNAMED(KSPROPSETID_Synth_Dls)
typedef enum
{
KSPROPERTY_SYNTH_DLS_DOWNLOAD = 0,
KSPROPERTY_SYNTH_DLS_UNLOAD,
KSPROPERTY_SYNTH_DLS_COMPACT,
KSPROPERTY_SYNTH_DLS_APPEND,
KSPROPERTY_SYNTH_DLS_WAVEFORMAT
} KSPROPERTY_SYNTH_DLS;
typedef struct _SYNTH_BUFFER
{
ULONG BufferSize;
PVOID BufferAddress;
} SYNTH_BUFFER, *PSYNTH_BUFFER;
typedef struct _SYNTHDOWNLOAD
{
HANDLE DownloadHandle;
BOOL Free; /* the client buffer can be freed */
} SYNTHDOWNLOAD, *PSYNTHDOWNLOAD;
#define STATIC_KSPROPSETID_Synth\
0xfedfae25L, 0xe46e, 0x11d1, 0xaa, 0xce, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12
DEFINE_GUIDSTRUCT("fedfae25-e46e-11d1-aace-0000f875ac12", KSPROPSETID_Synth);
#define KSPROPSETID_Synth DEFINE_GUIDNAMED(KSPROPSETID_Synth)
typedef enum
{
KSPROPERTY_SYNTH_VOLUME = 0, /* must be first */
KSPROPERTY_SYNTH_VOLUMEBOOST,
KSPROPERTY_SYNTH_CAPS,
KSPROPERTY_SYNTH_PORTPARAMETERS,
KSPROPERTY_SYNTH_CHANNELGROUPS,
KSPROPERTY_SYNTH_VOICEPRIORITY,
KSPROPERTY_SYNTH_LATENCYCLOCK,
KSPROPERTY_SYNTH_RUNNINGSTATS
} KSPROPERTY_SYNTH;
#define SYNTH_PC_DLS (0x00000001)
#define SYNTH_PC_EXTERNAL (0x00000002)
#define SYNTH_PC_SOFTWARESYNTH (0x00000004)
#define SYNTH_PC_MEMORYSIZEFIXED (0x00000008)
#define SYNTH_PC_GMINHARDWARE (0x00000010)
#define SYNTH_PC_GSINHARDWARE (0x00000020)
#if (NTDDI_VERSION < NTDDI_WINXP)
#define SYNTH_PC_REVERB (0x00000040)
#elif (NTDDI_VERSION >= NTDDI_WINXP)
#define SYNTH_PC_XGINHARDWARE (0x00000040)
// 0x80 used in user mode
// 0x100 used in user mode
#define SYNTH_PC_DLS2 (0x00000200)
// 0x400 used in user mode
// 0x800 used in user mode
#define SYNTH_PC_REVERB (0x40000000)
#endif
#define SYNTH_PC_SYSTEMMEMORY (0x7fffffff)
typedef struct _SYNTHCAPS
{
GUID Guid;
DWORD Flags;
DWORD MemorySize;
DWORD MaxChannelGroups;
DWORD MaxVoices;
DWORD MaxAudioChannels;
DWORD EffectFlags;
WCHAR Description[128];
} SYNTHCAPS, *PSYNTHCAPS;
typedef struct _SYNTH_PORTPARAMS
{
DWORD ValidParams;
DWORD Voices;
DWORD ChannelGroups;
DWORD AudioChannels;
DWORD SampleRate;
DWORD EffectsFlags;
DWORD Share;
} SYNTH_PORTPARAMS, *PSYNTH_PORTPARAMS;
/* These flags (set in ValidParams) indicate which
* other members of the SYNTH_PORTPARAMS are valid
*/
#define SYNTH_PORTPARAMS_VOICES 0x00000001
#define SYNTH_PORTPARAMS_CHANNELGROUPS 0x00000002
#define SYNTH_PORTPARAMS_AUDIOCHANNELS 0x00000004
#define SYNTH_PORTPARAMS_SAMPLERATE 0x00000008
#define SYNTH_PORTPARAMS_EFFECTS 0x00000020
#define SYNTH_PORTPARAMS_SHARE 0x00000040
/* SYNTH_EFFECT_ flags are used in the
* EffectFlags fields of SYNTH_PORTPARAMS.
*/
#define SYNTH_EFFECT_NONE 0x00000000
#define SYNTH_EFFECT_REVERB 0x00000001
#define SYNTH_EFFECT_CHORUS 0x00000002
#define SYNTH_EFFECT_DELAY 0x00000004
/*
* Instance data for KSPROPERTY_ITEM_SynthVoicePriority
*/
typedef struct _SYNTHVOICEPRIORITY_INSTANCE
{
DWORD ChannelGroup;
DWORD Channel;
} SYNTHVOICEPRIORITY_INSTANCE, *PSYNTHVOICEPRIORITY_INSTANCE;
/*
* Data returned by KSPROPERTY_SYNTH_RUNNINGSTATS
*/
typedef struct _SYNTH_STATS
{
DWORD ValidStats; /* Flags indicating which fields below are valid. */
DWORD Voices; /* Average number of voices playing. */
DWORD TotalCPU; /* Total CPU usage as percent * 100. */
DWORD CPUPerVoice; /* CPU per voice as percent * 100. */
DWORD LostNotes; /* Number of notes lost in 1 second. */
DWORD FreeMemory; /* Free memory in bytes */
LONG PeakVolume; /* Decibel level * 100. */
} SYNTH_STATS, *PSYNTH_STATS;
#define SYNTH_STATS_VOICES (1 << 0)
#define SYNTH_STATS_TOTAL_CPU (1 << 1)
#define SYNTH_STATS_CPU_PER_VOICE (1 << 2)
#define SYNTH_STATS_LOST_NOTES (1 << 3)
#define SYNTH_STATS_PEAK_VOLUME (1 << 4)
#define SYNTH_STATS_FREE_MEMORY (1 << 5)
#ifndef _DIRECTAUDIO_PRIORITIES_DEFINED_
#define _DIRECTAUDIO_PRIORITIES_DEFINED_
#define DAUD_CRITICAL_VOICE_PRIORITY (0xF0000000)
#define DAUD_HIGH_VOICE_PRIORITY (0xC0000000)
#define DAUD_STANDARD_VOICE_PRIORITY (0x80000000)
#define DAUD_LOW_VOICE_PRIORITY (0x40000000)
#define DAUD_PERSIST_VOICE_PRIORITY (0x10000000)
/* These are the default priorities assigned if not overridden. By default priorities are
* equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as
* channel 5 on channel group 2).
*
* In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16
* except for 10.
*/
#define DAUD_CHAN1_VOICE_PRIORITY_OFFSET (0x0000000E)
#define DAUD_CHAN2_VOICE_PRIORITY_OFFSET (0x0000000D)
#define DAUD_CHAN3_VOICE_PRIORITY_OFFSET (0x0000000C)
#define DAUD_CHAN4_VOICE_PRIORITY_OFFSET (0x0000000B)
#define DAUD_CHAN5_VOICE_PRIORITY_OFFSET (0x0000000A)
#define DAUD_CHAN6_VOICE_PRIORITY_OFFSET (0x00000009)
#define DAUD_CHAN7_VOICE_PRIORITY_OFFSET (0x00000008)
#define DAUD_CHAN8_VOICE_PRIORITY_OFFSET (0x00000007)
#define DAUD_CHAN9_VOICE_PRIORITY_OFFSET (0x00000006)
#define DAUD_CHAN10_VOICE_PRIORITY_OFFSET (0x0000000F)
#define DAUD_CHAN11_VOICE_PRIORITY_OFFSET (0x00000005)
#define DAUD_CHAN12_VOICE_PRIORITY_OFFSET (0x00000004)
#define DAUD_CHAN13_VOICE_PRIORITY_OFFSET (0x00000003)
#define DAUD_CHAN14_VOICE_PRIORITY_OFFSET (0x00000002)
#define DAUD_CHAN15_VOICE_PRIORITY_OFFSET (0x00000001)
#define DAUD_CHAN16_VOICE_PRIORITY_OFFSET (0x00000000)
#define DAUD_CHAN1_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN1_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN2_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN2_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN3_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN3_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN4_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN4_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN5_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN5_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN6_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN6_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN7_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN7_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN8_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN8_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN9_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN9_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN10_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN10_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN11_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN11_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN12_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN12_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN13_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN13_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN14_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN14_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN15_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN15_VOICE_PRIORITY_OFFSET)
#define DAUD_CHAN16_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN16_VOICE_PRIORITY_OFFSET)
#endif /* _DIRECTAUDIO_PRIORITIES_DEFINED_ */
/*
SDK Property sets and items
*/
typedef struct _SYNTH_REVERB_PARAMS
{
float fInGain; /* Input gain in dB (to avoid output overflows) */
float fReverbMix; /* Reverb mix in dB. 0dB means 100% wet reverb (no direct signal).
Negative values gives less wet signal. The coeficients are
calculated so that the overall output level stays (approximately)
constant regardless of the ammount of reverb mix. */
float fReverbTime; /* The reverb decay time, in milliseconds. */
float fHighFreqRTRatio; /* The ratio of the high frequencies to the global reverb time.
Unless very 'splashy-bright' reverbs are wanted, this should be set to
a value < 1.0. For example if dRevTime==1000ms and dHighFreqRTRatio=0.1
than the decay time for high frequencies will be 100ms.*/
} SYNTH_REVERB_PARAMS, *PSYNTH_REVERB_PARAMS;
#define STATIC_KSPROPSETID_SynthClock \
0xfedfae26L, 0xe46e, 0x11d1, 0xaa, 0xce, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12
DEFINE_GUIDSTRUCT("fedfae26-e46e-11d1-aace-0000f875ac12", KSPROPSETID_SynthClock);
#define KSPROPSETID_SynthClock DEFINE_GUIDNAMED(KSPROPSETID_SynthClock)
typedef enum
{
KSPROPERTY_SYNTH_MASTERCLOCK
} KSPROPERTY_SYNTHCLOCK;
#endif /* _DMusProp_ */

View File

@ -0,0 +1,847 @@
/*****************************************************************************\
* *
* DriverSpecs.h - markers for documenting the semantics of driver APIs *
* See also <SpecStrings.h> *
* *
* Version 1.2.10 *
* *
* Copyright (c) Microsoft Corporation. All rights reserved. *
* *
\*****************************************************************************/
/*****************************************************************************\
* NOTE *
* NOTE *
* NOTE *
* The macro bodies in this file are subject to change without notice. *
* Attempting to use the annotations in the macro bodies directly is not *
* supported. *
* NOTE *
* NOTE *
* NOTE *
\*****************************************************************************/
/*****************************************************************************\
* The annotations described by KernelSpecs.h and DriverSpecs.h, taken together,
* are used to annotate drivers. Many of the annotations are applicable to
* user space code (including subsystems) as well as to drivers.
*
* DriverSpecs.h contains those annotations which are appropriate to userspace
* code, or which might appear in headers that are shared between user space
* and kernel space. In the case of annotations which might appear in such a
* shared header, but which are meaningless in user space, the annotations are
* #defined to nothing in DriverSpecs.h.
*
* KernelSpecs.h contains those annotations which either will only appear in
* kernel code or headers; or which might appear in shared headers. In the
* latter case, it is assumed that DriverSpecs.h has been #included, and
* the anntoations are re-defined (using #undef) to give them a meaningful
* value. In general, documentation for the shared-header annotations appears
* in DriverSpecs.h.
*
* Many annotations are context dependent. They only apply to certain versions
* of Windows, or only to certain classes of driver. These rules can be written
* using something like __drv_when(NTDDI_VERSION >= NTDDI_WINXP, ...)
* which causes the rule only to apply to Windows XP and later. Many of these
* symbols are already defined in various Windows headers.
*
* To facilitate using this sort of conditional rule, we collect here the
* various known symbols that are (or reasonably might) be used in such
* a conditional annotation. Some are speculative in that the symbol has
* not yet been defined because there are no known uses of it yet.
*
* Where the symbol already exists its relevant header is
* noted below (excluding the "really well known" ones).
*
* Each symbol is listed with the currently known possible values.
*
* Some symbols are marked as #define symbols -- they are used with #ifdef
* operators only. To use them in __drv_when, use something like
* __drv_when(__drv_defined(NT), ...).
*
* WDK Version (copied for convenience from sdkddkver.h)
* NTDDI_VERSION: NTDDI_WIN2K NTDDI_WIN2KSP1 NTDDI_WIN2KSP2 NTDDI_WIN2KSP3
* NTDDI_WIN2KSP4 NTDDI_WINXP NTDDI_WINXPSP1 NTDDI_WINXPSP2
* NTDDI_WS03 NTDDI_WS03SP1 NTDDI_VISTA
* The WDK version is taken as the WDM version as well.
*
* OS Version: (copied for convenience from sdkddkver.h)
* _WIN32_WINNT: _WIN32_WINNT_NT4 _WIN32_WINNT_WIN2K _WIN32_WINNT_WINXP
* _WIN32_WINNT_WS03 _WIN32_WINNT_LONGHORN
* WINVER: 0x030B 0x0400 0x0500 0x0600
* NT (#define symbol)
* (sdkddkver.h also defines symbols for IE versions should they be needed.)
*
* Compiler Version:
* _MSC_VER: too many to list.
* _MSC_FULL_VER: too many to list.
*
* KMDF Version: (Currently defined/used only in makefiles.)
* KMDF_VERSION_MAJOR: 1
*
* UMDF Version: (Currently defined/used only in makefiles.)
* UMDF_VERSION_MAJOR: 1
*
* Architecture kinds:
* __WIN64 (#define symbols)
* _X86_
* _AMD64_
* _IA64_
*
* Machine Architectures:
* _M_IX86
* _M_AMD64
* _M_IA64
*
* Driver Kind (NYI: "not yet implemented")
* Typically these will be defined in the most-common header for a
* particular driver (or in individual source files if appropriate).
* These are not intended to necessarily be orthogonal: more than one might
* apply to a particular driver.
* _DRIVER_TYPE_BUS: 1 // NYI
* _DRIVER_TYPE_FUNCTIONAL: 1 // NYI
* _DRIVER_TYPE_MINIPORT: 1 // NYI
* _DRIVER_TYPE_STORAGE: 1 // NYI
* _DRIVER_TYPE_DISPLAY: 1 // NYI
* _DRIVER_TYPE_FILESYSTEM: 1
* _DRIVER_TYPE_FILESYSTEM_FILTER: 1
*
* NDIS driver version: (see ndis.h for much more detail.)
* These can be used to both identify an NDIS driver and to check the version.
* NDIS40 NDIS50 NDIS51 NDIS60 (#defined symbols)
* NDIS_PROTOCOL_MAJOR_VERSION.NDIS_PROTOCOL_MINOR_VERSION: 4.0 5.0 5.1 6.0
* And many others in ndis.h (including MINIPORT)
*
\*****************************************************************************/
#ifndef DRIVERSPECS_H
#define DRIVERSPECS_H
// In case driverspecs.h is included directly (and w/o specstrings.h)
#ifndef SPECSTRINGS_H
#include <specstrings.h>
#endif
#include "sdv_driverspecs.h"
#if _MSC_VER > 1000 // [
#pragma once
#endif // ]
#ifdef __cplusplus // [
extern "C" {
#endif // ]
#if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) // [
#define __drv_declspec(x) __declspec(x)
#define __$drv_group(annotes) \
__drv_declspec("SAL_begin") annotes __drv_declspec("SAL_end")
#define __drv_nop(x) x
#else // ][
#define __drv_declspec(x)
#define __$drv_group(x)
#endif // ]
#if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) && defined(_MSC_EXTENSIONS)// [
// Synthesize a unique symbol.
#define $$MKID(x, y) x ## y
#define $MKID(x, y) $$MKID(x, y)
#define $GENSYM(x) $MKID(x, __COUNTER__)
// ---------------------------------------------------------------------
// Processing mode selection:
//
// __internal_kernel_driver
//
// Flag for headers that indicates a probable driver.
// This should only be coded in headers that are normally used
// as the "primary" header for a class of drivers. It sets the
// default to kernel mode driver.
//
// ';' inside the parens to keep MIDL happy
__ANNOTATION(SAL_internal_kernel_driver();)
#define __internal_kernel_driver \
typedef int __drv_declspec("SAL_internal_kernel_driver") \
$GENSYM(__prefast_flag_kernel_driver_mode);
//
// __kernel_code
// __kernel_driver
// __user_driver
// __user_code
//
// Flags for compilation units that indicated specifically what kind of
// code it is.
// These should be coded as early as possible in any compilation unit
// (.c/.cpp file) that doesn't get the correct default. Whether before
// or after __internal_kernel_driver
//
// Indicate that the code is kernel, but not driver, code.
__ANNOTATION(SAL_kernel();)
__ANNOTATION(SAL_nokernel();)
__ANNOTATION(SAL_driver();)
__ANNOTATION(SAL_nodriver();)
#define __kernel_code \
typedef int __drv_declspec("SAL_kernel") \
__drv_declspec("SAL_nodriver") \
$GENSYM(__prefast_flag_kernel_driver_mode);
// Indicate that the code is kernel, driver, code.
#define __kernel_driver \
typedef int __drv_declspec("SAL_kernel") \
__drv_declspec("SAL_driver") \
$GENSYM(__prefast_flag_kernel_driver_mode);
// Indicate that the code is a user mode driver.
#define __user_driver \
typedef int __drv_declspec("SAL_nokernel") \
__drv_declspec("SAL_driver") \
$GENSYM(__prefast_flag_kernel_driver_mode);
// Indicate that the code is ordinary user mode code.
#define __user_code \
typedef int __drv_declspec("SAL_nokernel") \
__drv_declspec("SAL_nodriver") \
$GENSYM(__prefast_flag_kernel_driver_mode);
// "landmark" function definition to pass information to the
// analysis tools, as needed.
__ANNOTATION(SAL_landmark(__in char *);)
#define __drv_Mode_impl(x) \
__declspec("SAL_landmark(\"" #x "\")") \
__inline void $GENSYM(__SAL_dummy_)(void){}
// Macros to declare a function to be a particular class
// of driver.
#define __drv_WDM __drv_Mode_impl(WDM)
#define __drv_KMDF __drv_Mode_impl(KMDF)
#define __drv_NDIS __drv_Mode_impl(NDIS)
// Inform PREfast that operator new does [not] throw.
// Be sure you really know which is actually in use before using one of
// these. The default is throwing (and cannot return NULL) which is
// standard conformant, but much kernel code links with a non-throwing
// operator new.
//
// Header <new> will set the default to throwing, so be sure to place
// this after that header is included.
//
// Be sure to use these macros for this purpose as the implementation
// could change.
#define __prefast_operator_new_throws \
void* __cdecl operator new(size_t size) throw(std::bad_alloc); \
void* __cdecl operator new[](size_t size) throw(std::bad_alloc);
#define __prefast_operator_new_null \
void* __cdecl operator new(size_t size) throw(); \
void* __cdecl operator new[](size_t size) throw();
#else // ][
#define __internal_kernel_driver
#define __kernel_code
#define __kernel_driver
#define __user_driver
#define __user_code
#define __drv_Mode_impl(x)
#define __drv_WDM
#define __drv_KMDF
#define __drv_NDIS
#define __prefast_operator_new_throws
#define __prefast_operator_new_null
#endif // ]
// core macros: these provide syntatic wrappers to make other uses
// simpler.
// (Note: right now we can't safely use the ellipsis (...) macro
// syntax. If we could then '##__drv_nop(annotes)' below could be
// simply 'annotes', and we could code __$drv_group as __$drv_group(...)
// in the "expands to nothing" case.)
//
// For example:
// __drv_in(__drv_nonconstant __setsIRQL)
#define __drv_deref(annotes) __deref __$drv_group(##__drv_nop(annotes))
#define __drv_in(annotes) __pre __$drv_group(##__drv_nop(annotes))
#define __drv_in_deref(annotes) __pre __deref __$drv_group(##__drv_nop(annotes))
#define __drv_out(annotes) __post __$drv_group(##__drv_nop(annotes))
#define __drv_out_deref(annotes) __post __deref __$drv_group(##__drv_nop(annotes))
#define __drv_when(cond, annotes) \
__drv_declspec("SAL_when(" SPECSTRINGIZE(cond) ")") __$drv_group(##__drv_nop(annotes))
#define __drv_at(expr,annotes)\
__drv_declspec("SAL_at(" SPECSTRINGIZE(expr) ")") __$drv_group(##__drv_nop(annotes))
#define __drv_fun(annotes) __drv_at(return,##__drv_nop(annotes))
#define __drv_ret(annotes) __drv_at(return,##__drv_nop(annotes))
#define __drv_arg(expr,annotes) __drv_at(expr,##__drv_nop(annotes))
#define __drv_unit(p) \
typedef int __$drv_unit_##p \
$GENSYM(__prefast_flag_kernel_driver_mode);
// Internal macros for convenience
#define __$drv_unit_internal_kernel_driver \
__drv_declspec("SAL_internal_kernel_driver")
//
// __drv_unit
//
// Flags for compilation units that indicated specifically what kind of
// code it is.
// These should be coded as early as possible in any compilation unit
// (.c/.cpp file) that doesn't get the correct default. Whether before
// or after __internal_kernel_driver is immaterial as long as it will
// successfully parse.
//
// Indicate that the code is kernel, but not driver, code.
#define __$drv_unit_kernel_code \
__drv_declspec("SAL_kernel") __drv_declspec("SAL_nodriver")
// Indicate that the code is kernel, driver, code.
#define __$drv_unit_kernel_driver \
__drv_declspec("SAL_kernel") __drv_declspec("SAL_driver")
// Indicate that the code is a user mode driver.
#define __$drv_unit_user_driver \
__drv_declspec("SAL_nokernel") __drv_declspec("SAL_driver")
// Indicate that the code is ordinary user mode code.
#define __$drv_unit_user_code \
__drv_declspec("SAL_nokernel") __drv_declspec("SAL_nodriver")
// These are needed for backwards compatability.
#ifndef __internal_kernel_driver
#define __internal_kernel_driver __drv_unit(internal_kernel_driver)
#define __kernel_code __drv_unit(kernel_code)
#define __kernel_driver __drv_unit(kernel_driver)
#define __user_driver __drv_unit(user_driver)
#define __user_code __drv_unit(user_code)
#endif
// ---------------------------------------------------------------------
// Syntatic utilities:
//
// Needed to make the annotations convenient to use.
//
// So we can use a macro name that might be used in #ifdef context,
// where it's defined with no value.
// This should only be used inside a __drv_when condition.
//
#define __drv_defined(x) macroDefined$( #x )
// ---------------------------------------------------------------------
// Callback properties:
//
// __drv_functionClass(x)
//
// Flag that the the annotated function
// is a member of that function class. Some class names are recognized
// by PREfast itself for special treatment.
// This can be tested by the condition function inFunctionClass$()
//
__ANNOTATION(SAL_functionClass(__in char *);)
#define __drv_functionClass(x) \
__drv_out(__drv_declspec("SAL_functionClass(\""#x"\")"))
// ---------------------------------------------------------------------
// Resources:
//
// __drv_acquiresResource(kind)
// __drv_releasesResource(kind)
// __drv_acquiresResourceGlobal(kind,param)
// __drv_releasesResourceGlobal(kind,param)
// __drv_mustHold(kind)
// __drv_neverHold(kind)
// __drv_mustHoldGlobal(kind,param)
// __drv_neverHoldGlobal(kind,param)
//
// Flag that the annotated parameter acquires a resource of type kind.
//
__ANNOTATION(SAL_acquire(__in char *);)
#define __drv_acquiresResource(kind) \
__post __drv_declspec("SAL_acquire(\"" #kind "\")")
//
// Flag that the annotated parameter releases a resource of type kind.
//
__ANNOTATION(SAL_release(__in char *);)
#define __drv_releasesResource(kind) \
__post __drv_declspec("SAL_release(\"" #kind "\")")
//
// Flag that the annotated object acquires a global (otherwise anonymous)
// resource of type kind named by param.
//
__ANNOTATION(SAL_acquireGlobal(__in char *, ...);)
#define __drv_innerAcquiresGlobal(kind, param) \
__post __drv_declspec("SAL_acquireGlobal(\"" #kind "\"," \
SPECSTRINGIZE(param\t)")")
#define __drv_acquiresResourceGlobal(kind,param) \
__drv_innerAcquiresGlobal(kind, param)
//
// Flag that the annotated object acquires a global (otherwise anonymous)
// resource of type kind named by param.
//
__ANNOTATION(SAL_releaseGlobal(__in char *, ...);)
#define __drv_innerReleasesGlobal(kind, param) \
__post __drv_declspec("SAL_releaseGlobal(\"" #kind "\"," \
SPECSTRINGIZE(param\t)")")
#define __drv_releasesResourceGlobal(kind, param) \
__drv_innerReleasesGlobal(kind, param)
//
// Flag that the annotated parameter must hold a resource of type kind
//
__ANNOTATION(SAL_mustHold(__in char *);)
#define __drv_mustHold(kind) \
__pre __drv_declspec("SAL_mustHold(\""#kind"\")")
//
// Flag that the annotated object must hold a global resource
// of type kind named by param.
//
__ANNOTATION(SAL_mustHoldGlobal(__in char *, ...);)
#define __drv_innerMustHoldGlobal(kind, param) \
__pre __drv_declspec("SAL_mustHoldGlobal(\"" #kind "\"," \
SPECSTRINGIZE(param\t)")")
#define __drv_mustHoldGlobal(kind,param) \
__drv_innerMustHoldGlobal(kind, param)
//
// Flag that the annotated parameter must never hold a resource of type kind
//
__ANNOTATION(SAL_neverHold(__in char *);)
#define __drv_neverHold(kind) \
__pre __drv_declspec("SAL_neverHold(\"" #kind "\")")
//
// Flag that the annotated object must never hold a global resource
// of type kind named by param.
//
__ANNOTATION(SAL_neverHoldGlobal(__in char *, ...);)
#define __drv_innerNeverHoldGlobal(kind, param) \
__pre __drv_declspec("SAL_neverHoldGlobal(\"" #kind "\"," \
SPECSTRINGIZE(param\t)")")
#define __drv_neverHoldGlobal(kind,param) \
__drv_innerNeverHoldGlobal(kind, param)
// Predicates to determine if a resource is held
__PRIMOP(int, holdsResource$(__in __deferTypecheck char *,__in char *);)
__PRIMOP(int, holdsResourceGlobal$(__in char *, ...);)
// ---------------------------------------------------------------------
// Maintenance of IRQL values
//
// __drv_setsIRQL(irql)
// __drv_raisesIRQL(irql)
// __drv_requiresIRQL(irql)
// __drv_maxIRQL(irql)
// __drv_minIRQL(irql)
// __drv_savesIRQL
// __drv_restoresIRQL
// __drv_savesIRQLGlobal(kind,param)
// __drv_restoresIRQLGlobal(kind,param)
// __drv_minFunctionIRQL(irql)
// __drv_maxFunctionIRQL(irql)
// __drv_useCancelIRQL
// __drv_sameIRQL
//
// The funciton exits at IRQL irql
//
#define __drv_setsIRQL(irql) /* see kernelspecs.h */
//
// The funciton exits at IRQL irql, but this may only raise the irql.
//
#define __drv_raisesIRQL(irql) /* see kernelspecs.h */
//
// The called function must be entered at IRQL level
//
#define __drv_requiresIRQL(irql) /* see kernelspecs.h */
//
// The maximum IRQL at which the function may be called.
//
#define __drv_maxIRQL(irql) /* see kernelspecs.h */
//
// The minimum IRQL at which the function may be called.
//
#define __drv_minIRQL(irql) /* see kernelspecs.h */
//
// The current IRQL is saved in the annotated parameter
//
#define __drv_savesIRQL /* see kernelspecs.h */
//
// The current IRQL is saved in the (otherwise anonymous) global object
// identified by kind and further refined by param.
//
#define __drv_savesIRQLGlobal(kind,param) /* see kernelspecs.h */
//
// The current IRQL is restored from the annotated parameter
//
#define __drv_restoresIRQL /* see kernelspecs.h */
//
// The current IRQL is restored from the (otherwise anonymous) global object
// identified by kind and further refined by param.
//
#define __drv_restoresIRQLGlobal(kind,param) /* see kernelspecs.h */
// The minimum IRQL to which the function can lower itself. The IRQL
// at entry is assumed to be that value unless overridden.
#define __drv_minFunctionIRQL(irql) /* see kernelspecs.h */
// The maximum IRQL to which the function can raise itself.
#define __drv_maxFunctionIRQL(irql) /* see kernelspecs.h */
// The function must exit with the same IRQL it was entered with.
// (It may change it but it must restore it.)
#define __drv_sameIRQL /* see kernelspecs.h */
// The annotated parameter contains the cancelIRQL, which will be restored
// by the called function.
#define __drv_useCancelIRQL /* see kernelspecs.h */
// ---------------------------------------------------------------------
// Specific function behaviors
// The annotated function clears the requirement that DoInitializeing
// is cleared (or not).
__ANNOTATION(SAL_clearDoInit(enum __SAL_YesNo);)
#define __drv_clearDoInit(yesNo) \
__post __drv_declspec("SAL_clearDoInit(" SPECSTRINGIZE(yesNo) ")")
// This is (or is like) IoGetDmaAdapter: look for misuse of DMA pointers
__ANNOTATION(SAL_IoGetDmaAdapter(void);)
#define __drv_IoGetDmaAdapter \
__post __drv_declspec("SAL_IoGetDmaAdapter")
// ---------------------------------------------------------------------
// Function and out parameter return values.
//
// __drv_valueIs(<list>)
//
// The function being annotated will return each of the specified values
// during simulation. The items in the list are <relational op><constant>,
// e.g. ==0 or <0.
// This is a ; separated list of values. The internal parser will accept
// a comma-separated list. In the future __VA_ARGS__ could be used.
// See the documentation for use of this.
//
__ANNOTATION(SAL_return(__in __AuToQuOtE char *);)
#define __drv_valueIs(arglist) \
__post __drv_declspec("SAL_return("SPECSTRINGIZE(arglist)")")
// ---------------------------------------------------------------------
// Additional parameter checking.
//
// __drv_constant
// __drv_nonConstant
// __drv_strictTypeMatch(mode)
// __drv_strictType(type,mode)
//
// The actual parameter must evaluate to a constant (not a const).
//
__ANNOTATION(SAL_constant(enum __SAL_YesNo);)
#define __drv_constant __pre __drv_declspec("SAL_constant(__yes)")
//
// The actual parameter may never evaluate to a numeric constant
// (exclusive of a const symbol).
//
#define __drv_nonConstant __pre __drv_declspec("SAL_constant(__no)")
//
// The actual parameter must match the type of the annotated formal
// within the specifications set by mode.
//
__ANNOTATION(SAL_strictTypeMatch(__int64);)
#define __drv_strictTypeMatch(mode) \
__pre __drv_declspec("SAL_strictTypeMatch("SPECSTRINGIZE(mode)")")
//
// The actual parameter must match the type of typename (below)
// within the specifications set by mode.
//
__ANNOTATION(SAL_strictType(__in __AuToQuOtE char *);) // currently 1/2 args
#define __drv_strictType(typename,mode) \
__pre __drv_declspec("SAL_strictType("SPECSTRINGIZE(typename)","\
SPECSTRINGIZE(mode)")")
//
// The following modes are defined:
#define __drv_typeConst 0 // constants of that type
#define __drv_typeCond 1 // plus ?:
#define __drv_typeBitset 2 // plus all operators
#define __drv_typeExpr 3 // plus literal constants
//
// The actual parameter must be data (not a pointer). Used to
// prevent passing pointers to pointers when pointers to structures
// are needed (because &pXXX is a common error when pXXX is
// intended).
__ANNOTATION(SAL_mayBePointer(enum __SAL_YesNo);)
#define __drv_notPointer __pre __drv_declspec("SAL_mayBePointer(__no)")
//
// Convenience for the most common form of the above.
#define __drv_isObjectPointer __drv_deref(__drv_notPointer)
// ---------------------------------------------------------------------
// Memory management
//
// __drv_aliasesMem
// __drv_allocatesMem
// __drv_freesMem
//
// The annotated parameter is "kept" by the function, creating an
// alias, and relieving any obligation to free the object.
//
__ANNOTATION(SAL_IsAliased(void);)
#define __drv_aliasesMem __post __drv_declspec("SAL_IsAliased")
//
// Allocate/release memory-like objects.
// Kind is unused, but should be "mem" for malloc/free
// and "object" for new/delete.
__ANNOTATION(SAL_NeedsRelease(enum __SAL_YesNo);)
#define __drv_allocatesMem(kind) __post __drv_declspec("SAL_NeedsRelease(__yes)")
#define __drv_freesMem(kind) __post __drv_declspec("SAL_NeedsRelease(__no)")
// ---------------------------------------------------------------------
// Additional diagnostics
//
// __drv_preferredFunction
// __drv_reportError
//
//
// Function 'func' should be used for reason 'why'. Often used
// conditionally.
//
__ANNOTATION(SAL_preferredFunction(__in __AuToQuOtE char *, __in __AuToQuOtE char *);)
#define __drv_preferredFunction(func,why) \
__pre __drv_declspec( \
"SAL_preferredFunction(" SPECSTRINGIZE(func) "," \
SPECSTRINGIZE(why) ")")
//
// The error given by 'why' was detected. Used conditionally.
//
__ANNOTATION(SAL_error(__in __AuToQuOtE char *);)
#define __drv_reportError(why) \
__pre __drv_declspec("SAL_error(" SPECSTRINGIZE(why) ")")
// ---------------------------------------------------------------------
// Floating point save/restore:
//
// __drv_floatSaved
// __drv_floatRestored
// __drv_floatUsed
//
// The floating point hardware was saved (available to kernel)
__ANNOTATION(SAL_floatSaved(void);)
#define __drv_floatSaved __post __drv_declspec("SAL_floatSaved")
//
// The floating point hardware was restored (no longer available)
__ANNOTATION(SAL_floatRestored(void);)
#define __drv_floatRestored __post __drv_declspec("SAL_floatRestored")
//
// The function uses floating point. Functions with floating point
// in their type signature get this automatically.
__ANNOTATION(SAL_floatUsed(void);)
#define __drv_floatUsed __post __drv_declspec("SAL_floatUsed")
// ---------------------------------------------------------------------
// Usage:
//
// __drv_interlocked
// __drv_inTry
// __drv_notInTry
//
// The parameter is used for interlocked instructions.
__ANNOTATION(SAL_interlocked(void);)
#define __drv_interlocked __pre __drv_declspec("SAL_interlocked")
// The function must be called inside a try block
__ANNOTATION(SAL_inTry(enum __SAL_YesNo);)
#define __drv_inTry __pre __drv_declspec("SAL_inTry(__yes)")
// The function must not be called inside a try block
#define __drv_notInTry __pre __drv_declspec("SAL_inTry(__no)")
// ---------------------------------------------------------------------
// FormatString:
//
// kind can be "printf", "scanf", "strftime" or "FormatMessage".
__ANNOTATION(SAL_IsFormatString(__in char *);)
#define __drv_formatString(kind)\
__drv_declspec("SAL_IsFormatString(\"" #kind "\")")
// ---------------------------------------------------------------------
// SDV support: see the SDV documentation for details
// Identify dispatch callback types
__ANNOTATION(SAL_dispatchType(__in __int64);)
#define __drv_dispatchType(kindlist)\
__pre __drv_declspec("SAL_dispatchType("\
SPECSTRINGIZE(kindlist) ")" )
// Identify dispatch callback types - special case
#define __drv_dispatchType_other\
__drv_dispatchType(-1)
// Identify completion callback types
__ANNOTATION(SAL_completionType(__in __AuToQuOtE char *);)
#define __drv_completionType(kindlist)\
__drv_declspec("SAL_completionType("\
#kindlist ")" )
__ANNOTATION(SAL_callbackType(__in __AuToQuOtE char *);)
// Identify callback types (FDO or PDO)
#define __drv_callbackType(kind)\
__drv_declspec("SAL_callbackType("\
#kind ")" )
// ---------------------------------------------------------------------
// Composite:
#ifdef _PREFAST_ // [ expand to nothing immediately to avoid RC problem
//
// Exclusive Resources
#define __drv_acquiresExclusiveResource(kind) \
__$drv_group( \
__drv_neverHold(kind) \
__drv_acquiresResource(kind))
#define __drv_releasesExclusiveResource(kind) \
__$drv_group( \
__drv_mustHold(kind) \
__drv_releasesResource(kind))
#define __drv_acquiresExclusiveResourceGlobal(kind, param) \
__drv_neverHoldGlobal(kind, param) \
__drv_acquiresResourceGlobal(kind, param)
#define __drv_releasesExclusiveResourceGlobal(kind, param) \
__drv_mustHoldGlobal(kind, param) \
__drv_releasesResourceGlobal(kind, param)
//
// CancelSpinLock
#define __drv_acquiresCancelSpinLock \
__drv_innerNeverHoldGlobal(CancelSpinLock,) \
__drv_innerAcquiresGlobal(CancelSpinLock,)
#define __drv_releasesCancelSpinLock \
__drv_innerMustHoldGlobal(CancelSpinLock,) \
__drv_innerReleasesGlobal(CancelSpinLock,)
#define __drv_mustHoldCancelSpinLock \
__drv_innerMustHoldGlobal(CancelSpinLock,)
#define __drv_neverHoldCancelSpinLock \
__drv_innerNeverHoldGlobal(CancelSpinLock,)
#define __drv_holdsCancelSpinLock() \
holdsResourceGlobal$("CancelSpinLock",)
//
// CriticalRegion
#define __drv_acquiresCriticalRegion \
__drv_innerNeverHoldGlobal(CriticalRegion,) \
__drv_innerAcquiresGlobal(CriticalRegion,)
#define __drv_releasesCriticalRegion \
__drv_innerMustHoldGlobal(CriticalRegion,) \
__drv_innerReleasesGlobal(CriticalRegion,)
#define __drv_mustHoldCriticalRegion \
__drv_innerMustHoldGlobal(CriticalRegion,)
#define __drv_neverHoldCriticalRegion \
__drv_innerNeverHoldGlobal(CriticalRegion,)
#define __drv_holdsCriticalRegion() \
holdsResourceGlobal$("CriticalRegion",)
//
// PriorityRegion
#define __drv_acquiresPriorityRegion \
__drv_innerNeverHoldGlobal(PriorityRegion,) \
__drv_innerAcquiresGlobal(PriorityRegion,)
#define __drv_releasesPriorityRegion \
__drv_innerMustHoldGlobal(PriorityRegion,) \
__drv_innerReleasesGlobal(PriorityRegion,)
#define __drv_mustHoldPriorityRegion \
__drv_innerMustHoldGlobal(PriorityRegion,)
#define __drv_neverHoldPriorityRegion \
__drv_innerNeverHoldGlobal(PriorityRegion,)
#define __drv_holdsPriorityRegion() \
holdsResourceGlobal$("PriorityRegion",)
#else // ][
#define __drv_acquiresExclusiveResource(kind)
#define __drv_releasesExclusiveResource(kind)
#define __drv_acquiresExclusiveResourceGlobal(kind, param)
#define __drv_releasesExclusiveResourceGlobal(kind, param)
#define __drv_acquiresCancelSpinLock
#define __drv_releasesCancelSpinLock
#define __drv_mustHoldCancelSpinLock
#define __drv_holdsCancelSpinLock()
#define __drv_neverHoldCancelSpinLock
#define __drv_acquiresCriticalRegion
#define __drv_releasesCriticalRegion
#define __drv_mustHoldCriticalRegion
#define __drv_neverHoldCriticalRegion
#define __drv_holdsCriticalRegion()
#define __drv_acquiresPriorityRegion
#define __drv_releasesPriorityRegion
#define __drv_mustHoldPriorityRegion
#define __drv_neverHoldPriorityRegion
#define __drv_holdsPriorityRegion()
#endif // ]
// Passing the cancel Irql to a utility function
#define __drv_isCancelIRQL /* see kernelspecs.h */
__PRIMOP(int, inFunctionClass$(__in char *);)
// Check if this is kernel or driver code
__PRIMOP(int, isKernel$(void);)
__PRIMOP(int, isDriver$(void);)
#ifdef __cplusplus
}
#endif
#endif // DRIVERSPECS_H

View File

@ -0,0 +1,12 @@
//+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992-1999.
//
// File: drivinit.h
//
//----------------------------------------------------------------------------
// All items moved to wingdi.h

View File

@ -0,0 +1,199 @@
#ifndef _DRMK_H_
#define _DRMK_H_
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct tagDRMRIGHTS {
BOOL CopyProtect;
ULONG Reserved;
BOOL DigitalOutputDisable;
} DRMRIGHTS , *PDRMRIGHTS;
typedef const DRMRIGHTS *PCDRMRIGHTS;
#define DEFINE_DRMRIGHTS_DEFAULT(DrmRights) const DRMRIGHTS DrmRights = {FALSE, 0, FALSE}
// {1915C967-3299-48cb-A3E4-69FD1D1B306E}
DEFINE_GUID(IID_IDrmAudioStream,
0x1915c967, 0x3299, 0x48cb, 0xa3, 0xe4, 0x69, 0xfd, 0x1d, 0x1b, 0x30, 0x6e);
DECLARE_INTERFACE_(IDrmAudioStream, IUnknown)
{
// IUnknown methods
STDMETHOD_(NTSTATUS, QueryInterface)(THIS_
__in REFIID InterfaceId,
__out PVOID* Interface
) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
// IDrmAudioStream methods
STDMETHOD_(NTSTATUS,SetContentId)(THIS_
__in ULONG ContentId,
__in PCDRMRIGHTS DrmRights
) PURE;
};
typedef IDrmAudioStream *PDRMAUDIOSTREAM;
#define IMP_IDrmAudioStream\
STDMETHODIMP_(NTSTATUS) SetContentId\
( __in ULONG ContentId,\
__in PCDRMRIGHTS DrmRights\
);
typedef struct tagDRMFORWARD {
DWORD Flags;
PDEVICE_OBJECT DeviceObject;
PFILE_OBJECT FileObject;
PVOID Context;
} DRMFORWARD, *PDRMFORWARD;
typedef const DRMFORWARD *PCDRMFORWARD;
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
NTAPI
DrmAddContentHandlers(
__in ULONG ContentId,
__in_ecount(NumHandlers) PVOID* paHandlers,
__in ULONG NumHandlers
);
typedef
NTSTATUS
(NTAPI *PFNDRMADDCONTENTHANDLERS)(
__in ULONG ContentId,
__in PVOID* paHandlers,
__in ULONG NumHandlers
);
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
NTAPI
DrmCreateContentMixed(
__in PULONG paContentId,
__in ULONG cContentId,
__out PULONG pMixedContentId
);
typedef
NTSTATUS
(NTAPI *PFNDRMCREATECONTENTMIXED)(
__in PULONG paContentId,
__in ULONG cContentId,
__out PULONG pMixedContentId
);
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
NTAPI
DrmDestroyContent(
__in ULONG ContentId
);
typedef
NTSTATUS
(NTAPI *PFNDRMDESTROYCONTENT)(
__in ULONG ContentId
);
NTSTATUS
NTAPI
DrmForwardContentToDeviceObject(
__in ULONG ContentId,
__in_opt PVOID Reserved,
__in PCDRMFORWARD DrmForward
);
typedef
NTSTATUS
(NTAPI *PFNDRMFORWARDCONTENTTODEVICEOBJECT)(
__in ULONG ContentId,
__in PVOID Reserved,
__in PCDRMFORWARD DrmForward
);
__drv_maxIRQL(PASSIVE_LEVEL)
__drv_preferredFunction("DrmForwardContentToDeviceObject", "Obsolete")
NTSTATUS
NTAPI
DrmForwardContentToFileObject(
__in ULONG ContentId,
__in PFILE_OBJECT FileObject
);
typedef
NTSTATUS
(NTAPI *PFNDRMFORWARDCONTENTTOFILEOBJECT)(
__in ULONG ContentId,
__in PFILE_OBJECT FileObject
);
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
NTAPI
DrmForwardContentToInterface(
__in ULONG ContentId,
__in PUNKNOWN pUnknown,
__in ULONG NumMethods);
typedef
NTSTATUS
(NTAPI *PFNDRMFORWARDCONTENTTOINTERFACE)(
__in ULONG ContentId,
__in PUNKNOWN pUnknown,
__in ULONG NumMethods);
__drv_maxIRQL(PASSIVE_LEVEL)
NTSTATUS
NTAPI
DrmGetContentRights(
__in ULONG ContentId,
__out PDRMRIGHTS DrmRights
);
typedef
NTSTATUS
(NTAPI *PFNDRMGETCONTENTRIGHTS)(
__in ULONG ContentId,
__out PDRMRIGHTS DrmRights
);
//
// Structures for use with KSPROPERY_DRMAUDIOSTREAM_CONTENTID
//
typedef struct {
ULONG ContentId;
DRMRIGHTS DrmRights;
} KSDRMAUDIOSTREAM_CONTENTID, *PKSDRMAUDIOSTREAM_CONTENTID;
typedef struct {
KSPROPERTY Property;
PVOID Context;
// DRM API callback functions
PFNDRMADDCONTENTHANDLERS DrmAddContentHandlers;
PFNDRMCREATECONTENTMIXED DrmCreateContentMixed;
PFNDRMDESTROYCONTENT DrmDestroyContent;
PFNDRMFORWARDCONTENTTODEVICEOBJECT DrmForwardContentToDeviceObject;
PFNDRMFORWARDCONTENTTOFILEOBJECT DrmForwardContentToFileObject;
PFNDRMFORWARDCONTENTTOINTERFACE DrmForwardContentToInterface;
PFNDRMGETCONTENTRIGHTS DrmGetContentRights;
} KSP_DRMAUDIOSTREAM_CONTENTID, *PKSP_DRMAUDIOSTREAM_CONTENTID;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1 @@

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
/*++
Copyright (c) 1996 Microsoft Corporation
Module Name:
dxapi.h
Abstract:
This file defines the necessary structures, defines, and functions for
the DXAPI class driver.
Author:
Bill Parry (billpa)
Environment:
Kernel mode only
Revision History:
--*/
ULONG
DxApi(
IN ULONG dwFunctionNum,
IN PVOID lpvInBuffer,
IN ULONG cbInBuffer,
IN PVOID lpvOutBuffer,
IN ULONG cbOutBuffer
);
ULONG
DxApiGetVersion(
);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,153 @@
/*++
Copyright (c) 1989 Microsoft Corporation
Module Name:
fcbtable.h
Abstract:
This module defines the data structures that facilitate management of the
collection of FCB's associated with a NET_ROOT
Author:
--*/
#ifndef _RXFCBTABLE_
#define _RXFCBTABLE_
typedef struct _RX_FCB_TABLE_ENTRY {
//
// Normal Header for Refcounted Structure
//
NODE_TYPE_CODE NodeTypeCode;
NODE_BYTE_SIZE NodeByteSize;
//
// the computed hash value
//
ULONG HashValue;
//
// the path associated with the FCB
//
UNICODE_STRING Path;
//
// the threaded list of all entries in a bucket.
//
LIST_ENTRY HashLinks;
//
// Statistics for amortising lookup costs
//
LONG Lookups;
} RX_FCB_TABLE_ENTRY, *PRX_FCB_TABLE_ENTRY;
#define RX_FCB_TABLE_NUMBER_OF_HASH_BUCKETS 32
typedef struct _RX_FCB_TABLE {
//
// Normal Header for refcounted data structures
//
NODE_TYPE_CODE NodeTypeCode;
NODE_BYTE_SIZE NodeByteSize;
//
// version stamp changes on each insertion/removal
//
__volatile ULONG Version;
BOOLEAN CaseInsensitiveMatch;
USHORT NumberOfBuckets;
//
// Statistics for table maintenance
//
__volatile LONG Lookups;
__volatile LONG FailedLookups;
__volatile LONG Compares;
//
// Resource used to control table access
//
ERESOURCE TableLock;
//
// TableEntry for the Null string
//
PRX_FCB_TABLE_ENTRY TableEntryForNull;
//
// the hash buckets
//
LIST_ENTRY HashBuckets[RX_FCB_TABLE_NUMBER_OF_HASH_BUCKETS];
} RX_FCB_TABLE, *PRX_FCB_TABLE;
extern
VOID
RxInitializeFcbTable (
IN OUT PRX_FCB_TABLE FcbTable,
IN BOOLEAN CaseInsensitiveMatch
);
extern
VOID
RxFinalizeFcbTable (
IN OUT PRX_FCB_TABLE FcbTable
);
extern
PFCB
RxFcbTableLookupFcb (
IN PRX_FCB_TABLE FcbTable,
IN PUNICODE_STRING Path
);
extern
NTSTATUS
RxFcbTableInsertFcb (
IN OUT PRX_FCB_TABLE FcbTable,
IN OUT PFCB Fcb
);
extern
NTSTATUS
RxFcbTableRemoveFcb (
IN OUT PRX_FCB_TABLE FcbTable,
IN OUT PFCB Fcb
);
#define RxAcquireFcbTableLockShared(TABLE,WAIT) \
ExAcquireResourceSharedLite( &(TABLE)->TableLock, WAIT )
#define RxAcquireFcbTableLockExclusive(TABLE,WAIT) \
ExAcquireResourceExclusiveLite( &(TABLE)->TableLock, WAIT )
#define RxReleaseFcbTableLock(TABLE) \
ExReleaseResourceLite( &(TABLE)->TableLock )
#define RxIsFcbTableLockExclusive(TABLE) ExIsResourceAcquiredExclusiveLite( &(TABLE)->TableLock )
#define RxIsFcbTableLockAcquired(TABLE) ( ExIsResourceAcquiredSharedLite( &(TABLE)->TableLock ) || \
ExIsResourceAcquiredExclusiveLite( &(TABLE)->TableLock ) )
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,246 @@
//+-------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//--------------------------------------------------------------------------
#ifndef _PRINT_FILTER_UTIL_813b22ee_62f7_4200_
#define _PRINT_FILTER_UTIL_813b22ee_62f7_4200_
#if defined(__cplusplus)
//
// print filter pipeline
//
namespace pfp
{
//
// Helpful when you want to use a print read interface with XML SAX
// which needs an ISequentialStream
//
class PrintReadStreamToSeqStream : public ISequentialStream
{
public:
PrintReadStreamToSeqStream(
__in IPrintReadStream *pReadStream
) : m_cRef(1),
m_pStream(pReadStream)
{
m_pStream->AddRef();
}
~PrintReadStreamToSeqStream()
{
m_pStream->Release();
}
STDMETHODIMP_(ULONG)
AddRef(
VOID
)
{
return InterlockedIncrement(&m_cRef);
}
STDMETHODIMP_(ULONG)
Release(
VOID
)
{
ULONG cRefCount = InterlockedDecrement(&m_cRef);
if (cRefCount)
{
return cRefCount;
}
delete this;
return 0;
}
STDMETHODIMP
QueryInterface(
__in REFIID riid,
__out VOID **ppv
)
{
HRESULT hRes = E_POINTER;
if (ppv)
{
hRes = E_NOINTERFACE;
*ppv = NULL;
if (riid == IID_ISequentialStream)
{
*ppv = static_cast<ISequentialStream *>(this);
}
else if (riid == IID_IUnknown)
{
*ppv = static_cast<IUnknown *>(this);
}
if (*ppv)
{
AddRef();
hRes = S_OK;
}
}
return hRes;
}
STDMETHODIMP
Read(
__out_bcount(cb) void* pv,
__in ULONG cb,
__out ULONG *pcbRead
)
{
BOOL bEof;
return m_pStream->ReadBytes(pv, cb, pcbRead, &bEof);
}
STDMETHODIMP
Write(
__in_bcount(cb) void const* pv,
__in ULONG cb,
__out ULONG *pcbWritten
)
{
UNREFERENCED_PARAMETER(pv);
UNREFERENCED_PARAMETER(cb);
UNREFERENCED_PARAMETER(pcbWritten);
return E_NOTIMPL;
}
private:
LONG m_cRef;
IPrintReadStream *m_pStream;
};
//
// Helpful when you want to use a print write interface with XML SAX
// which needs an ISequentialStream
//
class PrintWriteStreamToSeqStream : public ISequentialStream
{
public:
PrintWriteStreamToSeqStream(
__in IPrintWriteStream *pWriteStream
) : m_cRef(1),
m_pStream(pWriteStream)
{
m_pStream->AddRef();
}
~PrintWriteStreamToSeqStream()
{
m_pStream->Close();
m_pStream->Release();
}
STDMETHODIMP_(ULONG)
AddRef(
VOID
)
{
return InterlockedIncrement(&m_cRef);
}
STDMETHODIMP_(ULONG)
Release(
VOID
)
{
ULONG cRefCount = InterlockedDecrement(&m_cRef);
if (cRefCount)
{
return cRefCount;
}
delete this;
return 0;
}
STDMETHODIMP
QueryInterface(
__in REFIID riid,
__out VOID **ppv
)
{
HRESULT hRes = E_POINTER;
if (ppv)
{
hRes = E_NOINTERFACE;
*ppv = NULL;
if (riid == IID_ISequentialStream)
{
*ppv = static_cast<ISequentialStream *>(this);
}
else if (riid == IID_IUnknown)
{
*ppv = static_cast<IUnknown *>(this);
}
if (*ppv)
{
AddRef();
hRes = S_OK;
}
}
return hRes;
}
STDMETHODIMP
Read(
__out_bcount(cb) void* pv,
__in ULONG cb,
__out ULONG *pcbRead
)
{
UNREFERENCED_PARAMETER(pv);
UNREFERENCED_PARAMETER(cb);
UNREFERENCED_PARAMETER(pcbRead);
return E_NOTIMPL;
}
STDMETHODIMP
Write(
__in_bcount(cb) void const* pv,
__in ULONG cb,
__out ULONG *pcbWritten
)
{
return m_pStream->WriteBytes(pv, cb, pcbWritten);
}
private:
LONG m_cRef;
IPrintWriteStream *m_pStream;
};
}; // namespace pfp
#endif // if defined(__cplusplus)
#endif // #ifndef _PRINT_FILTER_UTIL_813b22ee-62f7-4200-9c85-73d139eaa579_

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,420 @@
/*++
Copyright (c) 1989-2002 Microsoft Corporation
Module Name:
fltUser.h
Abstract:
Header file which contains the structures, type definitions,
constants, global variables and function prototypes that are
visible to user mode applications that interact with filters.
Environment:
User mode
--*/
#ifndef __FLTUSER_H__
#define __FLTUSER_H__
//
// IMPORTANT!!!!!
//
// This is how FltMgr was released (from oldest to newest)
// xpsp2, (srv03, w2ksp5), LH, Win7
//
//
// The defines items that are part of the filter manager baseline
//
#define FLT_MGR_BASELINE (((OSVER(NTDDI_VERSION) == NTDDI_WIN2K) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WIN2KSP4))) || \
((OSVER(NTDDI_VERSION) == NTDDI_WINXP) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WINXPSP2))) || \
((OSVER(NTDDI_VERSION) == NTDDI_WS03) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WS03SP1))) || \
(NTDDI_VERSION >= NTDDI_VISTA))
//
// This defines items that were added after XPSP2 was released. This means
// they are in Srv03 SP1, W2K SP4+URP, and Longhorn and above.
//
#define FLT_MGR_AFTER_XPSP2 (((OSVER(NTDDI_VERSION) == NTDDI_WIN2K) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WIN2KSP4))) || \
((OSVER(NTDDI_VERSION) == NTDDI_WINXP) && (SPVER(NTDDI_VERSION) > SPVER(NTDDI_WINXPSP2))) || \
((OSVER(NTDDI_VERSION) == NTDDI_WS03) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WS03SP1))) || \
(NTDDI_VERSION >= NTDDI_VISTA))
//
// This defines items that only exist in longhorn or later
//
#define FLT_MGR_LONGHORN (NTDDI_VERSION >= NTDDI_VISTA)
//
// This defines items that only exist in Windows 7 or later
//
#define FLT_MGR_WIN7 (NTDDI_VERSION >= NTDDI_WIN7)
///////////////////////////////////////////////////////////////////////////////
//
// Standard includes
//
///////////////////////////////////////////////////////////////////////////////
#include <fltUserStructures.h>
#ifdef __cplusplus
extern "C" {
#endif
//
// These are all of the baseline set of user-mode functions in FltMgr.
//
#if FLT_MGR_BASELINE
//
// Functions for loading, unloading and monitoring Filters
//
__checkReturn
HRESULT
WINAPI
FilterLoad (
__in LPCWSTR lpFilterName
);
__checkReturn
HRESULT
WINAPI
FilterUnload (
__in LPCWSTR lpFilterName
);
//****************************************************************************
//
// Functions for creating and closing handles
//
//****************************************************************************
//
// Filter
//
__checkReturn
HRESULT
WINAPI
FilterCreate (
__in LPCWSTR lpFilterName,
__deref_out HFILTER *hFilter
);
HRESULT
WINAPI
FilterClose(
__in HFILTER hFilter
);
//
// FilterInstance
//
__checkReturn
HRESULT
WINAPI
FilterInstanceCreate (
__in LPCWSTR lpFilterName,
__in LPCWSTR lpVolumeName,
__in_opt LPCWSTR lpInstanceName,
__deref_out HFILTER_INSTANCE *hInstance
);
HRESULT
WINAPI
FilterInstanceClose(
__in HFILTER_INSTANCE hInstance
);
//****************************************************************************
//
// Functions for creating and deleting FilterInstances in the
// device stack.
//
//****************************************************************************
__checkReturn
HRESULT
WINAPI
FilterAttach (
__in LPCWSTR lpFilterName,
__in LPCWSTR lpVolumeName,
__in_opt LPCWSTR lpInstanceName ,
__in_opt DWORD dwCreatedInstanceNameLength ,
__out_bcount_opt(dwCreatedInstanceNameLength) LPWSTR lpCreatedInstanceName
);
__checkReturn
HRESULT
WINAPI
FilterAttachAtAltitude (
__in LPCWSTR lpFilterName,
__in LPCWSTR lpVolumeName,
__in LPCWSTR lpAltitude,
__in_opt LPCWSTR lpInstanceName ,
__in_opt DWORD dwCreatedInstanceNameLength ,
__out_bcount_opt(dwCreatedInstanceNameLength) LPWSTR lpCreatedInstanceName
);
__checkReturn
HRESULT
WINAPI
FilterDetach (
__in LPCWSTR lpFilterName,
__in LPCWSTR lpVolumeName,
__in_opt LPCWSTR lpInstanceName
);
//****************************************************************************
//
// Functions for iterating through Filters and FilterInstances and
// getting information on a Filter or FilterInstance.
//
//****************************************************************************
//
// Functions for iterating through Filters
//
__checkReturn
HRESULT
WINAPI
FilterFindFirst (
__in FILTER_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned,
__out LPHANDLE lpFilterFind
);
__checkReturn
HRESULT
WINAPI
FilterFindNext (
__in HANDLE hFilterFind,
__in FILTER_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned
);
__checkReturn
HRESULT
WINAPI
FilterFindClose(
__in HANDLE hFilterFind
);
__checkReturn
HRESULT
WINAPI
FilterVolumeFindFirst (
__in FILTER_VOLUME_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned,
__out PHANDLE lpVolumeFind
);
__checkReturn
HRESULT
WINAPI
FilterVolumeFindNext (
__in HANDLE hVolumeFind,
__in FILTER_VOLUME_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned
);
HRESULT
WINAPI
FilterVolumeFindClose(
__in HANDLE hVolumeFind
);
//
// Functions for iterating through FilterInstances
//
__checkReturn
HRESULT
WINAPI
FilterInstanceFindFirst (
__in LPCWSTR lpFilterName,
__in INSTANCE_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned,
__out LPHANDLE lpFilterInstanceFind
);
__checkReturn
HRESULT
WINAPI
FilterInstanceFindNext (
__in HANDLE hFilterInstanceFind,
__in INSTANCE_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned
);
__checkReturn
HRESULT
WINAPI
FilterInstanceFindClose(
__in HANDLE hFilterInstanceFind
);
//
// Functions for iterating through VolumeInstances
//
__checkReturn
HRESULT
WINAPI
FilterVolumeInstanceFindFirst (
__in LPCWSTR lpVolumeName,
__in INSTANCE_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned,
__out LPHANDLE lpVolumeInstanceFind
);
__checkReturn
HRESULT
WINAPI
FilterVolumeInstanceFindNext (
__in HANDLE hVolumeInstanceFind,
__in INSTANCE_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned
);
HRESULT
WINAPI
FilterVolumeInstanceFindClose(
__in HANDLE hVolumeInstanceFind
);
//
// Functions for getting information on Filters and FilterInstances
//
__checkReturn
HRESULT
WINAPI
FilterGetInformation (
__in HFILTER hFilter,
__in FILTER_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned
);
__checkReturn
HRESULT
WINAPI
FilterInstanceGetInformation (
__in HFILTER_INSTANCE hInstance,
__in INSTANCE_INFORMATION_CLASS dwInformationClass,
__out_bcount_part(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer,
__in DWORD dwBufferSize,
__out LPDWORD lpBytesReturned
);
//****************************************************************************
//
// Functions for communicating with Filters and FilterInstances
//
//****************************************************************************
__checkReturn
HRESULT
WINAPI
FilterConnectCommunicationPort(
__in LPCWSTR lpPortName,
__in DWORD dwOptions,
__in_bcount_opt(wSizeOfContext) LPCVOID lpContext,
__in WORD wSizeOfContext,
__in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes ,
__deref_out HANDLE *hPort
);
__checkReturn
HRESULT
WINAPI
FilterSendMessage (
__in HANDLE hPort,
__in_bcount_opt(dwInBufferSize) LPVOID lpInBuffer,
__in DWORD dwInBufferSize,
__out_bcount_part_opt(dwOutBufferSize,*lpBytesReturned) LPVOID lpOutBuffer,
__in DWORD dwOutBufferSize,
__out LPDWORD lpBytesReturned
);
__checkReturn
HRESULT
WINAPI
FilterGetMessage (
__in HANDLE hPort,
__out_bcount(dwMessageBufferSize) PFILTER_MESSAGE_HEADER lpMessageBuffer,
__in DWORD dwMessageBufferSize,
__inout LPOVERLAPPED lpOverlapped
);
__checkReturn
HRESULT
WINAPI
FilterReplyMessage (
__in HANDLE hPort,
__in_bcount(dwReplyBufferSize) PFILTER_REPLY_HEADER lpReplyBuffer,
__in DWORD dwReplyBufferSize
);
//****************************************************************************
//
// Other support functions
//
//****************************************************************************
__checkReturn
HRESULT
WINAPI
FilterGetDosName (
__in LPCWSTR lpVolumeName,
__out_ecount(dwDosNameBufferSize) LPWSTR lpDosName,
__in DWORD dwDosNameBufferSize
);
#endif // end the FLT_MGR_BASELINE
#ifdef __cplusplus
} // Balance extern "C" above
#endif
#endif /* __FLTUSER_H__ */

View File

@ -0,0 +1,601 @@
/*++
Copyright (c) 1989-2002 Microsoft Corporation
Module Name:
fltUserStructures.h
Abstract:
This contains structures, types, and defintiions that are common to both
USER mode and KERNEL mode environments.
Environment:
User mode
--*/
#ifndef __FLT_USER_STRUCTURES_H__
#define __FLT_USER_STRUCTURES_H__
#if FLT_MGR_BASELINE
//
// Disable warning for this file
//
#define FLTAPI NTAPI
#define FILTER_NAME_MAX_CHARS 255
#define FILTER_NAME_MAX_BYTES (FILTER_NAME_MAX_CHARS * sizeof( WCHAR ))
#define VOLUME_NAME_MAX_CHARS 1024
#define VOLUME_NAME_MAX_BYTES (VOLUME_NAME_MAX_CHARS * sizeof( WCHAR ))
#define INSTANCE_NAME_MAX_CHARS 255
#define INSTANCE_NAME_MAX_BYTES (INSTANCE_NAME_MAX_CHARS * sizeof( WCHAR ))
typedef HANDLE HFILTER;
typedef HANDLE HFILTER_INSTANCE;
typedef HANDLE HFILTER_VOLUME;
//
// Note: this may be removed in future when all translations from NTSTATUS to
// Win32 error codes are checked in. This is interim - since there the
// translation is not in for all filter manager error codes,
// apps will have to access NTSTATUS codes directly
//
typedef __success(return >= 0) LONG NTSTATUS;
typedef NTSTATUS *PNTSTATUS;
///////////////////////////////////////////////////////////////////////////////
//
// Known File System Types
//
///////////////////////////////////////////////////////////////////////////////
typedef enum _FLT_FILESYSTEM_TYPE {
FLT_FSTYPE_UNKNOWN, //an UNKNOWN file system type
FLT_FSTYPE_RAW, //Microsoft's RAW file system (\FileSystem\RAW)
FLT_FSTYPE_NTFS, //Microsoft's NTFS file system (\FileSystem\Ntfs)
FLT_FSTYPE_FAT, //Microsoft's FAT file system (\FileSystem\Fastfat)
FLT_FSTYPE_CDFS, //Microsoft's CDFS file system (\FileSystem\Cdfs)
FLT_FSTYPE_UDFS, //Microsoft's UDFS file system (\FileSystem\Udfs)
FLT_FSTYPE_LANMAN, //Microsoft's LanMan Redirector (\FileSystem\MRxSmb)
FLT_FSTYPE_WEBDAV, //Microsoft's WebDav redirector (\FileSystem\MRxDav)
FLT_FSTYPE_RDPDR, //Microsoft's Terminal Server redirector (\Driver\rdpdr)
FLT_FSTYPE_NFS, //Microsoft's NFS file system (\FileSystem\NfsRdr)
FLT_FSTYPE_MS_NETWARE, //Microsoft's NetWare redirector (\FileSystem\nwrdr)
FLT_FSTYPE_NETWARE, //Novell's NetWare redirector
FLT_FSTYPE_BSUDF, //The BsUDF CD-ROM driver (\FileSystem\BsUDF)
FLT_FSTYPE_MUP, //Microsoft's Mup redirector (\FileSystem\Mup)
FLT_FSTYPE_RSFX, //Microsoft's WinFS redirector (\FileSystem\RsFxDrv)
FLT_FSTYPE_ROXIO_UDF1, //Roxio's UDF writeable file system (\FileSystem\cdudf_xp)
FLT_FSTYPE_ROXIO_UDF2, //Roxio's UDF readable file system (\FileSystem\UdfReadr_xp)
FLT_FSTYPE_ROXIO_UDF3, //Roxio's DVD file system (\FileSystem\DVDVRRdr_xp)
FLT_FSTYPE_TACIT, //Tacit FileSystem (\Device\TCFSPSE)
FLT_FSTYPE_FS_REC, //Microsoft's File system recognizer (\FileSystem\Fs_rec)
FLT_FSTYPE_INCD, //Nero's InCD file system (\FileSystem\InCDfs)
FLT_FSTYPE_INCD_FAT, //Nero's InCD FAT file system (\FileSystem\InCDFat)
FLT_FSTYPE_EXFAT, //Microsoft's EXFat FILE SYSTEM (\FileSystem\exfat)
FLT_FSTYPE_PSFS, //PolyServ's file system (\FileSystem\psfs)
FLT_FSTYPE_GPFS //IBM General Parallel File System (\FileSystem\gpfs)
} FLT_FILESYSTEM_TYPE, *PFLT_FILESYSTEM_TYPE;
/////////////////////////////////////////////////////////////////////////////
//
// The different types information that can be return on an Filter.
//
// Note: Entries with "Aggregate" in the name return information for
// both LEGACY and MINI filters.
//
/////////////////////////////////////////////////////////////////////////////
//
// In xpsp2 we do not have the concept of enumerating legacy filters
// For this reason there is no FilterAggregateBasicInfo in the V1 version
// of the enum
//
typedef enum _FILTER_INFORMATION_CLASS {
FilterFullInformation,
FilterAggregateBasicInformation, //Added to XP SP2 via QFE
FilterAggregateStandardInformation //Longhorn and later
} FILTER_INFORMATION_CLASS, *PFILTER_INFORMATION_CLASS;
//
// The structures for the information returned from the query of
// information on a Filter.
//
typedef struct _FILTER_FULL_INFORMATION {
ULONG NextEntryOffset;
ULONG FrameID;
ULONG NumberOfInstances;
USHORT FilterNameLength;
WCHAR FilterNameBuffer[1];
} FILTER_FULL_INFORMATION, *PFILTER_FULL_INFORMATION;
//
// This structure returns information for both legacy filters and mini
// filters.
//
// NOTE: Support for this structures exists in all OS's that support
// filter manager except XP SP2. It was added later to XP SP2
// via a QFE.
//
typedef struct _FILTER_AGGREGATE_BASIC_INFORMATION {
ULONG NextEntryOffset;
//
// ABI - Aggregate Basic Information flags
//
ULONG Flags;
#define FLTFL_AGGREGATE_INFO_IS_MINIFILTER 0x00000001
#define FLTFL_AGGREGATE_INFO_IS_LEGACYFILTER 0x00000002
union {
//
// Minifilter FULL information
//
struct {
ULONG FrameID;
ULONG NumberOfInstances;
USHORT FilterNameLength;
USHORT FilterNameBufferOffset;
USHORT FilterAltitudeLength;
USHORT FilterAltitudeBufferOffset;
} MiniFilter;
//
// Legacyfilter information
//
struct {
USHORT FilterNameLength;
USHORT FilterNameBufferOffset;
} LegacyFilter;
} Type;
} FILTER_AGGREGATE_BASIC_INFORMATION, *PFILTER_AGGREGATE_BASIC_INFORMATION;
//
// This structure returns information for both legacy filters and mini
// filters.
//
// NOTE: Support for this structures exists in Vista and Later
//
#if FLT_MGR_LONGHORN
typedef struct _FILTER_AGGREGATE_STANDARD_INFORMATION {
ULONG NextEntryOffset;
//
// ASI - Aggregate Standard Information flags
//
ULONG Flags;
#define FLTFL_ASI_IS_MINIFILTER 0x00000001
#define FLTFL_ASI_IS_LEGACYFILTER 0x00000002
union {
//
// Minifilter FULL information
//
struct {
//
// ASIM - Aggregate Standard Information Minifilter flags
//
ULONG Flags;
ULONG FrameID;
ULONG NumberOfInstances;
USHORT FilterNameLength;
USHORT FilterNameBufferOffset;
USHORT FilterAltitudeLength;
USHORT FilterAltitudeBufferOffset;
} MiniFilter;
//
// Legacyfilter information
//
struct {
//
// ASIL - Aggregate Standard Information LegacyFilter flags
//
ULONG Flags;
USHORT FilterNameLength;
USHORT FilterNameBufferOffset;
USHORT FilterAltitudeLength;
USHORT FilterAltitudeBufferOffset;
} LegacyFilter;
} Type;
} FILTER_AGGREGATE_STANDARD_INFORMATION, *PFILTER_AGGREGATE_STANDARD_INFORMATION;
#endif // FLT_MGR_LONGHORN
/////////////////////////////////////////////////////////////////////////////
//
// The different types information that can be return for a Volume
//
/////////////////////////////////////////////////////////////////////////////
typedef enum _FILTER_VOLUME_INFORMATION_CLASS {
FilterVolumeBasicInformation,
FilterVolumeStandardInformation //Longhorn and later
} FILTER_VOLUME_INFORMATION_CLASS, *PFILTER_VOLUME_INFORMATION_CLASS;
//
// Basic information about a volume (its name)
//
typedef struct _FILTER_VOLUME_BASIC_INFORMATION {
//
// Length of name
//
USHORT FilterVolumeNameLength;
//
// Buffer containing name (it's NOT NULL-terminated)
//
WCHAR FilterVolumeName[1];
} FILTER_VOLUME_BASIC_INFORMATION, *PFILTER_VOLUME_BASIC_INFORMATION;
//
// Additional volume information.
//
// NOTE: Only available in LONGHORN and later OS's
//
#if FLT_MGR_LONGHORN
typedef struct _FILTER_VOLUME_STANDARD_INFORMATION {
ULONG NextEntryOffset;
//
// VSI - VOlume Standard Information flags
//
ULONG Flags;
//
// If set this volume is not current attached to a storage stack
//
#define FLTFL_VSI_DETACHED_VOLUME 0x00000001
//
// Identifies which frame this volume structure is in
//
ULONG FrameID;
//
// Identifies the type of file system being used on the volume
//
FLT_FILESYSTEM_TYPE FileSystemType;
//
// Length of name
//
USHORT FilterVolumeNameLength;
//
// Buffer containing name (it's NOT NULL-terminated)
//
WCHAR FilterVolumeName[1];
} FILTER_VOLUME_STANDARD_INFORMATION, *PFILTER_VOLUME_STANDARD_INFORMATION;
#endif // FLT_MGR_LONGHORN
/////////////////////////////////////////////////////////////////////////////
//
// The different types information that can be return on an Instance.
//
/////////////////////////////////////////////////////////////////////////////
typedef enum _INSTANCE_INFORMATION_CLASS {
InstanceBasicInformation,
InstancePartialInformation,
InstanceFullInformation,
InstanceAggregateStandardInformation //LONGHORN and later
} INSTANCE_INFORMATION_CLASS, *PINSTANCE_INFORMATION_CLASS;
//
// The structures for the information returned from the query of the information
// on the Instance.
//
typedef __struct_bcount(sizeof(INSTANCE_BASIC_INFORMATION) * InstanceNameLength) struct _INSTANCE_BASIC_INFORMATION {
ULONG NextEntryOffset;
USHORT InstanceNameLength;
USHORT InstanceNameBufferOffset;
} INSTANCE_BASIC_INFORMATION, *PINSTANCE_BASIC_INFORMATION;
typedef __struct_bcount(sizeof(INSTANCE_PARTIAL_INFORMATION) + InstanceNameLength + AltitudeLength) struct _INSTANCE_PARTIAL_INFORMATION {
ULONG NextEntryOffset;
USHORT InstanceNameLength;
USHORT InstanceNameBufferOffset;
USHORT AltitudeLength;
USHORT AltitudeBufferOffset;
} INSTANCE_PARTIAL_INFORMATION, *PINSTANCE_PARTIAL_INFORMATION;
typedef __struct_bcount(sizeof(INSTANCE_FULL_INFORMATION) + InstanceNameLength + AltitudeLength + VolumeNameLength + FilterNameLength) struct _INSTANCE_FULL_INFORMATION {
ULONG NextEntryOffset;
USHORT InstanceNameLength;
USHORT InstanceNameBufferOffset;
USHORT AltitudeLength;
USHORT AltitudeBufferOffset;
USHORT VolumeNameLength;
USHORT VolumeNameBufferOffset;
USHORT FilterNameLength;
USHORT FilterNameBufferOffset;
} INSTANCE_FULL_INFORMATION, *PINSTANCE_FULL_INFORMATION;
//
// This information class is used to return instance information about both
// legacy filters and minifilters.
//
#if FLT_MGR_LONGHORN
typedef struct _INSTANCE_AGGREGATE_STANDARD_INFORMATION {
ULONG NextEntryOffset;
//
// IASI - Instance Aggregate Standard Information flags
//
ULONG Flags;
#define FLTFL_IASI_IS_MINIFILTER 0x00000001
#define FLTFL_IASI_IS_LEGACYFILTER 0x00000002
union {
//
// MiniFilter information
//
struct {
//
// IASIM - Instance Aggregate Standard Information Minifilter flags
//
ULONG Flags;
//
// If set this volume is not current attached to a storage stack
//
#define FLTFL_IASIM_DETACHED_VOLUME 0x00000001
//
// Identifies which frame this volume structure is in
//
ULONG FrameID;
//
// The type of file system this instance is attached to
//
FLT_FILESYSTEM_TYPE VolumeFileSystemType;
//
// The name of this instance
//
USHORT InstanceNameLength;
USHORT InstanceNameBufferOffset;
//
// The altitude of this instance
//
USHORT AltitudeLength;
USHORT AltitudeBufferOffset;
//
// The volume name this instance is attached to
//
USHORT VolumeNameLength;
USHORT VolumeNameBufferOffset;
//
// The name of the minifilter associated with this instace
//
USHORT FilterNameLength;
USHORT FilterNameBufferOffset;
} MiniFilter;
//
// Legacyfilter information
//
struct {
//
// IASIL - Instance Aggregate Standard Information LegacyFilter flags
//
ULONG Flags;
//
// If set this volume is not current attached to a storage stack
//
#define FLTFL_IASIL_DETACHED_VOLUME 0x00000001
//
// The altitude of this attachment
//
USHORT AltitudeLength;
USHORT AltitudeBufferOffset;
//
// The volume name this filter is attached to
//
USHORT VolumeNameLength;
USHORT VolumeNameBufferOffset;
//
// The name of the filter associated with this attachment
//
USHORT FilterNameLength;
USHORT FilterNameBufferOffset;
} LegacyFilter;
} Type;
} INSTANCE_AGGREGATE_STANDARD_INFORMATION, *PINSTANCE_AGGREGATE_STANDARD_INFORMATION;
#endif // FLT_MGR_LONGHORN
/////////////////////////////////////////////////////////////////////////////
//
// Message defintitions
//
/////////////////////////////////////////////////////////////////////////////
typedef struct _FILTER_MESSAGE_HEADER {
//
// OUT
//
// Total buffer length in bytes, including the FILTER_REPLY_HEADER, of
// the expected reply. If no reply is expected, 0 is returned.
//
ULONG ReplyLength;
//
// OUT
//
// Unique Id for this message. This will be set when the kernel message
// satifies this FilterGetMessage or FilterInstanceGetMessage request.
// If replying to this message, this is the MessageId that should be used.
//
ULONGLONG MessageId;
//
// General filter-specific buffer data follows...
//
} FILTER_MESSAGE_HEADER, *PFILTER_MESSAGE_HEADER;
typedef struct _FILTER_REPLY_HEADER {
//
// IN.
//
// Status of this reply. This status will be returned back to the filter
// driver who is waiting for a reply.
//
NTSTATUS Status;
//
// IN
//
// Unique Id for this message. This id was returned in the
// FILTER_MESSAGE_HEADER from the kernel message to which we are replying.
//
ULONGLONG MessageId;
//
// General filter-specific buffer data follows...
//
} FILTER_REPLY_HEADER, *PFILTER_REPLY_HEADER;
#endif //FLT_MGR_BASELINE
#endif /* __FLT_USER_STRUCTURES_H__ */

View File

@ -0,0 +1,383 @@
/*++ BUILD Version: 0005 // Increment this if a change has global effects
Copyright (c) 1989-2002 Microsoft Corporation. All rights reserved.
Module Name:
fltWinError.h
Abstract:
Constant definitions for the HRESULTS values defined by the Filter Manager.
Environment:
User mode
--*/
#ifndef _FLT_WINERROR_
#define _FLT_WINERROR_
//
// For Windows version 6.00 and later, these error codes are defined in
// winerror.h. Only use these definitions if not already defined
//
#if NTDDI_VERSION < NTDDI_VISTA
#ifndef FACILITY_USERMODE_FILTER_MANAGER
//
// HRESULT
// FILTER_HRESULT_FROM_FLT_NTSTATUS (
// IN NTSTATUS FltNtStatus
// )
//
// Macro Description:
//
// This macro does the translation from a Filter Manager defined NTSTATUS
// code to a Filter Manager Library HRESULT. The Filter Manager Library
// error code is built as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +-+-+-+-+-----------------------+-------------------------------+
// |S|R|C|R| FltMgr Facility |(Code part of FltNtStatus) |
// | | | | | | bit-wise or'd with 0x0000 |
// +-+-+-+-+-----------------------+-------------------------------+
//
// where
//
// S - Severity - 1 to indicate FAILURE
//
// R - reserved portion of the facility code, corresponds to NT's
// second severity bit.
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - FACILITY_USERMODE_FILTER_MANAGER
//
// Code - Code portion of the NTSTATUS
//
// Arguments:
//
// FltNtStatus - The NTSTATUS error code with the Filter Manager facility
// code to translate to an Filter Manager Library HRESULT.
//
// Return Value:
//
// The appropriate HRESULT.
//
#define FILTER_HRESULT_FROM_FLT_NTSTATUS(x) (ASSERT((x & 0xfff0000) == 0x001c0000),(HRESULT) (((x) & 0x8000FFFF) | (FACILITY_USERMODE_FILTER_MANAGER << 16)))
//////////////////////////////////////////////////////////////////////
//
// HRESULTs for Filter Manager defined NTSTATUS codes
//
//////////////////////////////////////////////////////////////////////
//
// Values are 32 bit values laid out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
#define FACILITY_USERMODE_FILTER_MANAGER 0x1F
//
// Define the severity codes
//
//
// MessageId: ERROR_FLT_IO_COMPLETE
//
// MessageText:
//
// The IO was completed by a filter.
//
#define ERROR_FLT_IO_COMPLETE ((HRESULT)0x001F0001L)
//
// MessageId: ERROR_FLT_NO_HANDLER_DEFINED
//
// MessageText:
//
// A handler was not defined by the filter for this operation.
//
#define ERROR_FLT_NO_HANDLER_DEFINED ((HRESULT)0x801F0001L)
//
// MessageId: ERROR_FLT_CONTEXT_ALREADY_DEFINED
//
// MessageText:
//
// A context is already defined for this object.
//
#define ERROR_FLT_CONTEXT_ALREADY_DEFINED ((HRESULT)0x801F0002L)
//
// MessageId: ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST
//
// MessageText:
//
// Asynchronous requests are not valid for this operation.
//
#define ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST ((HRESULT)0x801F0003L)
//
// MessageId: ERROR_FLT_DISALLOW_FAST_IO
//
// MessageText:
//
// Disallow the Fast IO path for this operation.
//
#define ERROR_FLT_DISALLOW_FAST_IO ((HRESULT)0x801F0004L)
//
// MessageId: ERROR_FLT_INVALID_NAME_REQUEST
//
// MessageText:
//
// An invalid name request was made. The name requested cannot be retrieved at this time.
//
#define ERROR_FLT_INVALID_NAME_REQUEST ((HRESULT)0x801F0005L)
//
// MessageId: ERROR_FLT_NOT_SAFE_TO_POST_OPERATION
//
// MessageText:
//
// Posting this operation to a worker thread for further processing is not safe
// at this time because it could lead to a system deadlock.
//
#define ERROR_FLT_NOT_SAFE_TO_POST_OPERATION ((HRESULT)0x801F0006L)
//
// MessageId: ERROR_FLT_NOT_INITIALIZED
//
// MessageText:
//
// The Filter Manager was not initialized when a filter tried to register. Make
// sure that the Filter Manager is getting loaded as a driver.
//
#define ERROR_FLT_NOT_INITIALIZED ((HRESULT)0x801F0007L)
//
// MessageId: ERROR_FLT_FILTER_NOT_READY
//
// MessageText:
//
// The filter is not ready for attachment to volumes because it has not finished
// initializing (FltStartFiltering has not been called).
//
#define ERROR_FLT_FILTER_NOT_READY ((HRESULT)0x801F0008L)
//
// MessageId: ERROR_FLT_POST_OPERATION_CLEANUP
//
// MessageText:
//
// The filter must cleanup any operation specific context at this time because
// it is being removed from the system before the operation is completed by
// the lower drivers.
//
#define ERROR_FLT_POST_OPERATION_CLEANUP ((HRESULT)0x801F0009L)
//
// MessageId: ERROR_FLT_INTERNAL_ERROR
//
// MessageText:
//
// The Filter Manager had an internal error from which it cannot recover,
// therefore the operation has been failed. This is usually the result
// of a filter returning an invalid value from a pre-operation callback.
//
#define ERROR_FLT_INTERNAL_ERROR ((HRESULT)0x801F000AL)
//
// MessageId: ERROR_FLT_DELETING_OBJECT
//
// MessageText:
//
// The object specified for this action is in the process of being
// deleted, therefore the action requested cannot be completed at
// this time.
//
#define ERROR_FLT_DELETING_OBJECT ((HRESULT)0x801F000BL)
//
// MessageId: ERROR_FLT_MUST_BE_NONPAGED_POOL
//
// MessageText:
//
// Non-paged pool must be used for this type of context.
//
#define ERROR_FLT_MUST_BE_NONPAGED_POOL ((HRESULT)0x801F000CL)
//
// MessageId: ERROR_FLT_DUPLICATE_ENTRY
//
// MessageText:
//
// A duplicate handler definition has been provided for an operation.
//
#define ERROR_FLT_DUPLICATE_ENTRY ((HRESULT)0x801F000DL)
//
// MessageId: ERROR_FLT_CBDQ_DISABLED
//
// MessageText:
//
// The callback data queue has been disabled.
//
#define ERROR_FLT_CBDQ_DISABLED ((HRESULT)0x801F000EL)
//
// MessageId: ERROR_FLT_DO_NOT_ATTACH
//
// MessageText:
//
// Do not attach the filter to the volume at this time.
//
#define ERROR_FLT_DO_NOT_ATTACH ((HRESULT)0x801F000FL)
//
// MessageId: ERROR_FLT_DO_NOT_DETACH
//
// MessageText:
//
// Do not detach the filter from the volume at this time.
//
#define ERROR_FLT_DO_NOT_DETACH ((HRESULT)0x801F0010L)
//
// MessageId: ERROR_FLT_INSTANCE_ALTITUDE_COLLISION
//
// MessageText:
//
// An instance already exists at this altitude on the volume specified.
//
#define ERROR_FLT_INSTANCE_ALTITUDE_COLLISION ((HRESULT)0x801F0011L)
//
// MessageId: ERROR_FLT_INSTANCE_NAME_COLLISION
//
// MessageText:
//
// An instance already exists with this name on the volume specified.
//
#define ERROR_FLT_INSTANCE_NAME_COLLISION ((HRESULT)0x801F0012L)
//
// MessageId: ERROR_FLT_FILTER_NOT_FOUND
//
// MessageText:
//
// The system could not find the filter specified.
//
#define ERROR_FLT_FILTER_NOT_FOUND ((HRESULT)0x801F0013L)
//
// MessageId: ERROR_FLT_VOLUME_NOT_FOUND
//
// MessageText:
//
// The system could not find the volume specified.
//
#define ERROR_FLT_VOLUME_NOT_FOUND ((HRESULT)0x801F0014L)
//
// MessageId: ERROR_FLT_INSTANCE_NOT_FOUND
//
// MessageText:
//
// The system could not find the instance specified.
//
#define ERROR_FLT_INSTANCE_NOT_FOUND ((HRESULT)0x801F0015L)
//
// MessageId: ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND
//
// MessageText:
//
// No registered context allocation definition was found for the given request.
//
#define ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND ((HRESULT)0x801F0016L)
//
// MessageId: ERROR_FLT_INVALID_CONTEXT_REGISTRATION
//
// MessageText:
//
// An invalid parameter was specified during context registration.
//
#define ERROR_FLT_INVALID_CONTEXT_REGISTRATION ((HRESULT)0x801F0017L)
//
// MessageId: ERROR_FLT_NAME_CACHE_MISS
//
// MessageText:
//
// The name requested was not found in Filter Manager's name cache and could not be retrieved from the file system.
//
#define ERROR_FLT_NAME_CACHE_MISS ((HRESULT)0x801F0018L)
//
// MessageId: ERROR_FLT_NO_DEVICE_OBJECT
//
// MessageText:
//
// The requested device object does not exist for the given volume.
//
#define ERROR_FLT_NO_DEVICE_OBJECT ((HRESULT)0x801F0019L)
//
// MessageId: ERROR_FLT_VOLUME_ALREADY_MOUNTED
//
// MessageText:
//
// The specified volume is already mounted.
//
#define ERROR_FLT_VOLUME_ALREADY_MOUNTED ((HRESULT)0x801F001AL)
//
// MessageId: ERROR_FLT_NO_WAITER_FOR_REPLY
//
// MessageText:
//
// No waiter is present for the filter's reply to this message.
//
#define ERROR_FLT_NO_WAITER_FOR_REPLY ((HRESULT)0x801F0020L)
#endif // !FACILITY_USERMODE_FILTER_MANAGER
#endif //NTDDIVER < WIN_LH
#endif //_FLT_WINERROR_

View File

@ -0,0 +1,30 @@
#if (NTDDI_VERSION >= NTDDI_WINXP)
// fltsafe.h
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// FLOATSAFE
//
// Saves floating point state on construction and restores on destruction.
//
struct FLOATSAFE
{
KFLOATING_SAVE FloatSave;
NTSTATUS ntStatus;
FLOATSAFE::FLOATSAFE(void)
{
ntStatus = KeSaveFloatingPointState(&FloatSave);
}
FLOATSAFE::~FLOATSAFE(void)
{
if (NT_SUCCESS(ntStatus))
{
KeRestoreFloatingPointState(&FloatSave);
}
}
};
#endif

View File

@ -0,0 +1,191 @@
/*
* FullEnumSyncDeviceService.h
*
* Contains definitions for the Full Enumeration Sync Device Service
*
* Copyright (c) Microsoft Corporation, All Rights Reserved.
*
*/
#ifndef _FULLENUMSYNCSERVICE_H_
#define _FULLENUMSYNCSERVICE_H_
#include <DeviceServices.h>
#include <SyncDeviceService.h>
/*****************************************************************************/
/* Full Enumeration Sync Service Info */
/*****************************************************************************/
DEFINE_DEVSVCGUID(SERVICE_FullEnumSync,
0x28d3aac9, 0xc075, 0x44be, 0x88, 0x81, 0x65, 0xf3, 0x8d, 0x30, 0x59, 0x09);
#define NAME_FullEnumSyncSvc L"FullEnumSync"
#define TYPE_FullEnumSyncSvc DEVSVCTYPE_ABSTRACT
/*****************************************************************************/
/* Full Enumeration Sync Service Properties */
/*****************************************************************************/
DEFINE_DEVSVCGUID(NAMESPACE_FullEnumSyncSvc,
0x63b10e6c, 0x4f3a, 0x456d, 0x95, 0xcb, 0x98, 0x94, 0xed, 0xec, 0x9f, 0xa5);
/* PKEY_FullEnumSyncSvc_VersionProps
*
* Provides information about change units and version properties. The
* format for the dataset is
*
* UINT32 Number of change units
* UINT128 Namespace GUID for first change unit property key
* UINT32 Namespace ID for the first change unit property key
* UINT32 Number of properties associated with this change unit
* UINT128 Namespace GUID for first property key in change unit
* UINT32 Namespace ID for first property key in change unit
* ... Repeat for number of property keys
* ... Repeat for number of change units
*
* NOTE: If all change units use the same property key specify a namespace
* GUID of GUID_NULL (all 0's) and a namespace ID of 0.
*
* Type: UInt8
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_FullEnumSyncSvc_VersionProps,
0x63b10e6c, 0x4f3a, 0x456d, 0x95, 0xcb, 0x98, 0x94, 0xed, 0xec, 0x9f, 0xa5,
3);
#define NAME_FullEnumSyncSvc_VersionProps L"FullEnumVersionProps"
/* PKEY_FullEnumSyncSvc_ReplicaID
*
* Contains the GUID representing this replica in the sync community.
*
* Type: UInt128
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_FullEnumSyncSvc_ReplicaID,
0x63b10e6c, 0x4f3a, 0x456d, 0x95, 0xcb, 0x98, 0x94, 0xed, 0xec, 0x9f, 0xa5,
4);
#define NAME_FullEnumSyncSvc_ReplicaID L"FullEnumReplicaID"
/* PKEY_FullEnumSyncSvc_KnowledgeObjectID
*
* Object ID to be used for the knowledge object
*
* Type: UInt32
* Form: ObjectID
*/
DEFINE_DEVSVCPROPKEY(PKEY_FullEnumSyncSvc_KnowledgeObjectID,
0x63b10e6c, 0x4f3a, 0x456d, 0x95, 0xcb, 0x98, 0x94, 0xed, 0xec, 0x9f, 0xa5,
7);
#define NAME_FullEnumSyncSvc_KnowledgeObjectID L"FullEnumKnowledgeObjectID"
/* PKEY_FullEnumSyncSvc_LastSyncProxyID
*
* Contains a GUID indicating the last sync proxy to perform a sync operation
*
* Type: UInt128
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_FullEnumSyncSvc_LastSyncProxyID,
0x63b10e6c, 0x4f3a, 0x456d, 0x95, 0xcb, 0x98, 0x94, 0xed, 0xec, 0x9f, 0xa5,
8);
#define NAME_FullEnumSyncSvc_LastSyncProxyID L"FullEnumLastSyncProxyID"
/* PKEY_FullEnumSyncSvc_ProviderVersion
*
* Contains a device defined value giving the version of the provider
* currently in use on the device. This version must be incremented whenever
* new properties are added to the device implementation so that they will
* be recognized and managed as part of synchronization. 0 is reserved.
*
* Type: UInt16
* Form: None
*/
DEFINE_DEVSVCPROPKEY(PKEY_FullEnumSyncSvc_ProviderVersion,
0x63b10e6c, 0x4f3a, 0x456d, 0x95, 0xcb, 0x98, 0x94, 0xed, 0xec, 0x9f, 0xa5,
9);
#define NAME_FullEnumSyncSvc_ProviderVersion L"FullEnumProviderVersion"
/* PKEY_FullEnumSyncSvc_SyncFormat
*
* Indicates the format GUID for the object format that is to be used in the
* sync operation.
*
* Type: UInt128
* Form: None
*/
#define PKEY_FullEnumSyncSvc_SyncFormat PKEY_SyncSvc_SyncFormat
#define NAME_FullEnumSyncSvc_SyncFormat NAME_SyncSvc_SyncFormat
/* PKEY_FullEnumSyncSvc_LocalOnlyDelete
*
* Boolean flag indicating whether deletes of objects on the service host
* should be treated as "local only" and not propogated to other sync
* participants. The alternative is "true sync" in which deletes on the
* service host are propogated to all other sync participants.
*
* Type: UInt8
* Form: None
*/
#define PKEY_FullEnumSyncSvc_LocalOnlyDelete PKEY_SyncSvc_LocalOnlyDelete
#define NAME_FullEnumSyncSvc_LocalOnlyDelete NAME_SyncSvc_LocalOnlyDelete
/* PKEY_FullEnumSyncSvc_FilterType
*
* Type: UInt8
* Form: None
*/
#define PKEY_FullEnumSyncSvc_FilterType PKEY_SyncSvc_FilterType
#define NAME_FullEnumSyncSvc_FilterType NAME_SyncSvc_FilterType
/*****************************************************************************/
/* Full Enumeration Sync Service Object Formats */
/*****************************************************************************/
/* FORMAT_FullEnumSyncKnowledge
*
* Knowledge object format
*/
DEFINE_DEVSVCGUID(FORMAT_FullEnumSyncKnowledge,
0x221bce32, 0x221b, 0x4f45, 0xb4, 0x8b, 0x80, 0xde, 0x9a, 0x93, 0xa4, 0x4a);
#define NAME_FullEnumSyncKnowledge L"FullEnumSyncKnowledge"
/*****************************************************************************/
/* Full Enumeration Sync Service Methods */
/*****************************************************************************/
/* Inherited methods
*/
#define METHOD_FullEnumSyncSvc_BeginSync METHOD_SyncSvc_BeginSync
#define NAME_FullEnumSyncSvc_BeginSync NAME_SyncSvc_BeginSync
#define METHOD_FullEnumSyncSvc_EndSync METHOD_SyncSvc_EndSync
#define NAME_FullEnumSyncSvc_EndSync NAME_SyncSvc_EndSync
#endif /* _FULLENUMSYNCSERVICE_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,361 @@
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Assumptions for the type definitions:
// ULONGLONG = 64bit unsigned integer
// ULONG = 32bit unsigned integer
// USHORT = 16bit unsigned integer
// UCHAR = 8bit unsigned integer
//
#ifndef _HDAUDIO_H_
#define _HDAUDIO_H_
#pragma warning(disable:4201) // nameless struct/union
#pragma warning(disable:4214) // bit field types other than int
//
// The HDAUDIO_BUS_INTERFACE interface GUID
//
// {D2EAF88B-AB18-41a8-B664-8D592167671B}
DEFINE_GUID (GUID_HDAUDIO_BUS_INTERFACE,
0xd2eaf88b, 0xab18, 0x41a8, 0xb6, 0x64, 0x8d, 0x59, 0x21, 0x67, 0x67, 0x1b);
//
// The HDAUDIO_BUS_INTERFACE_BDL interface GUID
//
// {B4D65397-5634-40b0-B068-F5B9F8B967A5}
DEFINE_GUID(GUID_HDAUDIO_BUS_INTERFACE_BDL,
0xb4d65397, 0x5634, 0x40b0, 0xb0, 0x68, 0xf5, 0xb9, 0xf8, 0xb9, 0x67, 0xa5);
//
// The HDAUDIO_BUS_INTERFACE_V2 interface GUID
//
// {B52AF5FB-424B-4BB9-A160-5B38BE94E568}
DEFINE_GUID (GUID_HDAUDIO_BUS_INTERFACE_V2,
0xb52af5fb, 0x424b, 0x4bb9, 0xa1, 0x60, 0x5b, 0x38, 0xbe, 0x94, 0xe5, 0x68);
//
// The HDAudio bus class GUID
//
// {BBD1A745-ADD6-4575-9C2E-9B428D1C3266}
DEFINE_GUID (GUID_HDAUDIO_BUS_CLASS,
0xbbd1a745, 0xadd6, 0x4575, 0x9c, 0x2e, 0x9b, 0x42, 0x8d, 0x1c, 0x32, 0x66);
#ifndef _HDAUDIO_CODEC_TRANSFER_
#define _HDAUDIO_CODEC_TRANSFER_
//
// Structure for a codec command.
//
typedef struct _HDAUDIO_CODEC_COMMAND
{
union
{
struct
{
ULONG Data : 8;
ULONG VerbId : 12;
ULONG Node : 8;
ULONG CodecAddress : 4;
} Verb8;
struct
{
ULONG Data : 16;
ULONG VerbId : 4;
ULONG Node : 8;
ULONG CodecAddress : 4;
} Verb16;
ULONG Command;
};
} HDAUDIO_CODEC_COMMAND, *PHDAUDIO_CODEC_COMMAND;
//
// Structure to access a codec response.
//
typedef struct _HDAUDIO_CODEC_RESPONSE
{
union
{
struct
{
union
{
struct
{
ULONG Response:21;
ULONG SubTag : 5;
ULONG Tag : 6;
} Unsolicited;
ULONG Response;
};
ULONG SDataIn : 4;
ULONG IsUnsolicitedResponse : 1;
ULONG :25;
ULONG HasFifoOverrun : 1;
ULONG IsValid : 1;
};
ULONGLONG CompleteResponse; // Mostly used for debug print messages.
};
} HDAUDIO_CODEC_RESPONSE, *PHDAUDIO_CODEC_RESPONSE;
//
// The structure passed in for sending CODEC verbs.
//
typedef struct _HDAUDIO_CODEC_TRANSFER
{
HDAUDIO_CODEC_COMMAND Output;
HDAUDIO_CODEC_RESPONSE Input;
} HDAUDIO_CODEC_TRANSFER, *PHDAUDIO_CODEC_TRANSFER;
#endif
//
// Replacement for WAVEFORMATEXTENSIBLE which has fields that are not used.
//
typedef struct _HDAUDIO_STREAM_FORMAT
{
ULONG SampleRate;
USHORT ValidBitsPerSample;
USHORT ContainerSize;
USHORT NumberOfChannels;
} HDAUDIO_STREAM_FORMAT, *PHDAUDIO_STREAM_FORMAT;
//
// The stream descriptor format used to program the input/output converters.
//
typedef struct _HDAUDIO_CONVERTER_FORMAT
{
union
{
struct
{
USHORT NumberOfChannels : 4;
USHORT BitsPerSample : 3;
USHORT : 1;
USHORT SampleRate : 7;
USHORT StreamType : 1; // Is always set to 0 by bus driver DDI
};
USHORT ConverterFormat;
};
} HDAUDIO_CONVERTER_FORMAT, *PHDAUDIO_CONVERTER_FORMAT;
//
// The different stream states supported by HDAudio -> STOP (reset), PAUSE or RUN
//
typedef enum _HDAUDIO_STREAM_STATE
{
ResetState = 0,
StopState = 1,
PauseState = 1,
RunState = 2
} HDAUDIO_STREAM_STATE, *PHDAUDIO_STREAM_STATE;
//
// The different power states that HD Audio codecs can support. All states
// are from DEVICE_POWER_STATE except PowerCodecD3Cold.
//
typedef enum _HDAUDIO_CODEC_POWER_STATE {
PowerCodecUnspecified = 0,
PowerCodecD0,
PowerCodecD1,
PowerCodecD2,
PowerCodecD3,
PowerCodecD3Cold,
PowerCodecMaximum
} HDAUDIO_CODEC_POWER_STATE, *PHDAUDIO_CODEC_POWER_STATE;
//
// HDAudio codec transfer complete callback function
//
typedef VOID (*PHDAUDIO_TRANSFER_COMPLETE_CALLBACK)(HDAUDIO_CODEC_TRANSFER *, PVOID);
//
// HDAudio unsolicited response callback function
//
typedef VOID (*PHDAUDIO_UNSOLICITED_RESPONSE_CALLBACK)(HDAUDIO_CODEC_RESPONSE, PVOID);
//
// HDAudio device information structure
//
typedef struct _HDAUDIO_DEVICE_INFORMATION
{
USHORT Size; // size of this structure
USHORT DeviceVersion; // maj.min (maj is high byte, min is low byte)
USHORT DriverVersion; // maj.min (maj is high byte, min is low byte)
USHORT CodecsDetected; // mask of codecs present. Bit number == SDI line number
BOOLEAN IsStripingSupported; // TRUE if striping (2 SDO lines) is supported
} HDAUDIO_DEVICE_INFORMATION, *PHDAUDIO_DEVICE_INFORMATION;
//
// HDAudio Buffer Descriptor list entry
//
typedef struct _HDAUDIO_BUFFER_DESCRIPTOR
{
PHYSICAL_ADDRESS Address;
ULONG Length;
ULONG InterruptOnCompletion;
} HDAUDIO_BUFFER_DESCRIPTOR, *PHDAUDIO_BUFFER_DESCRIPTOR;
typedef __checkReturn NTSTATUS (*PTRANSFER_CODEC_VERBS) (__in PVOID _context, __in ULONG Count, __inout_ecount(Count) PHDAUDIO_CODEC_TRANSFER CodecTransfer, __in PHDAUDIO_TRANSFER_COMPLETE_CALLBACK Callback, __in PVOID Context);
typedef __checkReturn NTSTATUS (*PALLOCATE_CAPTURE_DMA_ENGINE) (__in PVOID _context, __in UCHAR CodecAddress, __in PHDAUDIO_STREAM_FORMAT StreamFormat, OUT PHANDLE Handle, __out PHDAUDIO_CONVERTER_FORMAT ConverterFormat);
typedef __checkReturn NTSTATUS (*PALLOCATE_RENDER_DMA_ENGINE) (__in PVOID _context, __in PHDAUDIO_STREAM_FORMAT StreamFormat, __in BOOLEAN Stripe, __out PHANDLE Handle, __out PHDAUDIO_CONVERTER_FORMAT ConverterFormat);
typedef __checkReturn NTSTATUS (*PCHANGE_BANDWIDTH_ALLOCATION) (__in PVOID _context, __in HANDLE Handle, __in PHDAUDIO_STREAM_FORMAT StreamFormat, __out PHDAUDIO_CONVERTER_FORMAT ConverterFormat);
typedef __checkReturn NTSTATUS (*PALLOCATE_DMA_BUFFER) (__in PVOID _context, __in HANDLE Handle, __in SIZE_T RequestedBufferSize, __out PMDL *BufferMdl, __out PSIZE_T AllocatedBufferSize, OUT PUCHAR StreamId, __out PULONG FifoSize);
typedef __checkReturn NTSTATUS (*PFREE_DMA_BUFFER) (__in PVOID _context, __in HANDLE Handle);
typedef __checkReturn NTSTATUS (*PFREE_DMA_ENGINE) (__in PVOID _context, __in HANDLE Handle);
typedef __checkReturn NTSTATUS (*PSET_DMA_ENGINE_STATE) (__in PVOID _context, __in HDAUDIO_STREAM_STATE StreamState, __in ULONG NumberOfHandles, __in PHANDLE Handles);
typedef VOID (*PGET_WALL_CLOCK_REGISTER) (__in PVOID _context, __out PULONG *Wallclock);
typedef __checkReturn NTSTATUS (*PGET_LINK_POSITION_REGISTER) (__in PVOID _context, __in HANDLE Handle, __out PULONG *Position);
typedef __checkReturn NTSTATUS (*PREGISTER_EVENT_CALLBACK) (__in PVOID _context, __in PHDAUDIO_UNSOLICITED_RESPONSE_CALLBACK Routine, __in PVOID Context, __out PUCHAR Tag);
typedef __checkReturn NTSTATUS (*PUNREGISTER_EVENT_CALLBACK) (__in PVOID _context, __in UCHAR Tag);
typedef __checkReturn NTSTATUS (*PGET_DEVICE_INFORMATION) (__in PVOID _context, __in __out PHDAUDIO_DEVICE_INFORMATION DeviceInformation);
typedef VOID (*PGET_RESOURCE_INFORMATION) (__in PVOID _context, __out PUCHAR CodecAddress, __out PUCHAR FunctionGroupStartNode);
typedef struct _HDAUDIO_BUS_INTERFACE
{
//
// First we define the standard INTERFACE structure ...
//
USHORT Size;
USHORT Version;
PVOID Context;
PINTERFACE_REFERENCE InterfaceReference;
PINTERFACE_DEREFERENCE InterfaceDereference;
//
// Then we expand the structure with our interface specific data
//
PTRANSFER_CODEC_VERBS TransferCodecVerbs;
PALLOCATE_CAPTURE_DMA_ENGINE AllocateCaptureDmaEngine;
PALLOCATE_RENDER_DMA_ENGINE AllocateRenderDmaEngine;
PCHANGE_BANDWIDTH_ALLOCATION ChangeBandwidthAllocation;
PALLOCATE_DMA_BUFFER AllocateDmaBuffer;
PFREE_DMA_BUFFER FreeDmaBuffer;
PFREE_DMA_ENGINE FreeDmaEngine;
PSET_DMA_ENGINE_STATE SetDmaEngineState;
PGET_WALL_CLOCK_REGISTER GetWallClockRegister;
PGET_LINK_POSITION_REGISTER GetLinkPositionRegister;
PREGISTER_EVENT_CALLBACK RegisterEventCallback;
PUNREGISTER_EVENT_CALLBACK UnregisterEventCallback;
PGET_DEVICE_INFORMATION GetDeviceInformation;
PGET_RESOURCE_INFORMATION GetResourceInformation;
} HDAUDIO_BUS_INTERFACE, *PHDAUDIO_BUS_INTERFACE;
//
// To support the Bdl interface...
//
//
// ISR Callback definition for Bdl interface
//
typedef void (*PHDAUDIO_BDL_ISR) (__in VOID *Context, __in ULONG InterruptBitMask);
//
// Additional BDL interface functions.
//
typedef __checkReturn NTSTATUS (*PALLOCATE_CONTIGUOUS_DMA_BUFFER) (__in PVOID _context, __in HANDLE Handle,
ULONG RequestedBufferSize, __out PVOID *DataBuffer, __out PHDAUDIO_BUFFER_DESCRIPTOR *BdlBuffer);
typedef __checkReturn NTSTATUS (*PFREE_CONTIGUOUS_DMA_BUFFER) (__in PVOID _context, __in HANDLE Handle);
typedef __checkReturn NTSTATUS (*PSETUP_DMA_ENGINE_WITH_BDL) (__in_bcount(BufferLength) PVOID _context, __in HANDLE Handle, __in ULONG BufferLength,
__in ULONG Lvi, __in PHDAUDIO_BDL_ISR Isr, __in PVOID Context, __out PUCHAR StreamId, __out PULONG FifoSize);
typedef struct _HDAUDIO_BUS_INTERFACE_BDL
{
//
// First we define the standard INTERFACE structure ...
//
USHORT Size;
USHORT Version;
PVOID Context;
PINTERFACE_REFERENCE InterfaceReference;
PINTERFACE_DEREFERENCE InterfaceDereference;
//
// Then we expand the structure with the HDAUDIO_BUS_INTERFACE_BDL stuff.
// Many functions are identical (and derived) from the HDAUDIO_BUS_INTERFACE
// interface. PrepareDmaEngineWithBdl was added instead of PrepareDmaEngine
// and GetDeviceInformationBdl instead of GetDeviceInformation.
//
PTRANSFER_CODEC_VERBS TransferCodecVerbs;
PALLOCATE_CAPTURE_DMA_ENGINE AllocateCaptureDmaEngine;
PALLOCATE_RENDER_DMA_ENGINE AllocateRenderDmaEngine;
PCHANGE_BANDWIDTH_ALLOCATION ChangeBandwidthAllocation;
PALLOCATE_CONTIGUOUS_DMA_BUFFER AllocateContiguousDmaBuffer;
PSETUP_DMA_ENGINE_WITH_BDL SetupDmaEngineWithBdl;
PFREE_CONTIGUOUS_DMA_BUFFER FreeContiguousDmaBuffer;
PFREE_DMA_ENGINE FreeDmaEngine;
PSET_DMA_ENGINE_STATE SetDmaEngineState;
PGET_WALL_CLOCK_REGISTER GetWallClockRegister;
PGET_LINK_POSITION_REGISTER GetLinkPositionRegister;
PREGISTER_EVENT_CALLBACK RegisterEventCallback;
PUNREGISTER_EVENT_CALLBACK UnregisterEventCallback;
PGET_DEVICE_INFORMATION GetDeviceInformation;
PGET_RESOURCE_INFORMATION GetResourceInformation;
} HDAUDIO_BUS_INTERFACE_BDL, *PHDAUDIO_BUS_INTERFACE_BDL;
//
// Additional interface functions for DMA notification support
//
typedef __checkReturn NTSTATUS (*PALLOCATE_DMA_BUFFER_WITH_NOTIFICATION) (__in PVOID _context,
__in HANDLE Handle,
__in ULONG NotificationCount,
__in SIZE_T RequestedBufferSize,
__out PMDL *BufferMdl,
__out PSIZE_T AllocatedBufferSize,
__out PSIZE_T OffsetFromFirstPage,
__out PUCHAR StreamId,
__out PULONG FifoSize);
typedef __checkReturn NTSTATUS (*PFREE_DMA_BUFFER_WITH_NOTIFICATION) ( __in PVOID _context,
__in HANDLE Handle,
__in PMDL BufferMdl,
__in SIZE_T BufferSize);
typedef __checkReturn NTSTATUS (*PREGISTER_NOTIFICATION_EVENT) (__in PVOID _context,
__in HANDLE Handle,
__in PKEVENT NotificationEvent);
typedef __checkReturn NTSTATUS (*PUNREGISTER_NOTIFICATION_EVENT) (__in PVOID _context,
__in HANDLE Handle,
__in PKEVENT NotificationEvent);
typedef struct _HDAUDIO_BUS_INTERFACE_V2
{
//
// First we define the standard INTERFACE structure ...
//
USHORT Size;
USHORT Version;
PVOID Context;
PINTERFACE_REFERENCE InterfaceReference;
PINTERFACE_DEREFERENCE InterfaceDereference;
//
// Then we expand the structure with the HDAUDIO_BUS_INTERFACE_PING_PONG stuff.
// Many functions are identical (and derived) from the HDAUDIO_BUS_INTERFACE
// interface.
PTRANSFER_CODEC_VERBS TransferCodecVerbs;
PALLOCATE_CAPTURE_DMA_ENGINE AllocateCaptureDmaEngine;
PALLOCATE_RENDER_DMA_ENGINE AllocateRenderDmaEngine;
PCHANGE_BANDWIDTH_ALLOCATION ChangeBandwidthAllocation;
PALLOCATE_DMA_BUFFER AllocateDmaBuffer;
PFREE_DMA_BUFFER FreeDmaBuffer;
PFREE_DMA_ENGINE FreeDmaEngine;
PSET_DMA_ENGINE_STATE SetDmaEngineState;
PGET_WALL_CLOCK_REGISTER GetWallClockRegister;
PGET_LINK_POSITION_REGISTER GetLinkPositionRegister;
PREGISTER_EVENT_CALLBACK RegisterEventCallback;
PUNREGISTER_EVENT_CALLBACK UnregisterEventCallback;
PGET_DEVICE_INFORMATION GetDeviceInformation;
PGET_RESOURCE_INFORMATION GetResourceInformation;
PALLOCATE_DMA_BUFFER_WITH_NOTIFICATION AllocateDmaBufferWithNotification;
PFREE_DMA_BUFFER_WITH_NOTIFICATION FreeDmaBufferWithNotification;
PREGISTER_NOTIFICATION_EVENT RegisterNotificationEvent;
PUNREGISTER_NOTIFICATION_EVENT UnregisterNotificationEvent;
} HDAUDIO_BUS_INTERFACE_V2, *PHDAUDIO_BUS_INTERFACE_V2;
#pragma warning(default:4201)
#pragma warning(default:4214)
#endif // _HDAUDIO_H_

View File

@ -0,0 +1,245 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
hidclass.h
Abstract
Definitions that are common to clients of the HID class driver.
Environment:
Kernel mode only
Revision History:
--*/
#include <basetyps.h>
//
// Define the HID class guid *OUTSIDE* the #ifndef/#endif to allow
// multiple includes with precompiled headers.
//
DEFINE_GUID( GUID_DEVINTERFACE_HID, 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, \
0x11, 0x11, 0x00, 0x00, 0x30);
// Obsolete GUID naming convention.
#define GUID_CLASS_INPUT GUID_DEVINTERFACE_HID
//
// 2c4e2e88-25e6-4c33-882f-3d82e6073681
//
DEFINE_GUID( GUID_HID_INTERFACE_NOTIFY, 0x2c4e2e88L, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81 );
// {F5C315A5-69AC-4bc2-9279-D0B64576F44B}
DEFINE_GUID( GUID_HID_INTERFACE_HIDPARSE, 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b );
#ifndef __HIDCLASS_H__
#define __HIDCLASS_H__
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning(disable:4201) // nameless struct/union
#define GUID_CLASS_INPUT_STR "4D1E55B2-F16F-11CF-88CB-001111000030"
//
// HID_REVISION specifies the minimum revision of HIDCLASS.SYS
// required to support minidrivers compiled with this header file.
//
#define HID_REVISION 0x00000001
//
// Macro for defining HID ioctls
//
#define HID_CTL_CODE(id) \
CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
#define HID_BUFFER_CTL_CODE(id) \
CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
#define HID_IN_CTL_CODE(id) \
CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
#define HID_OUT_CTL_CODE(id) \
CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
//
// IOCTLs supported by the upper edge of the HID class driver
//
#define IOCTL_HID_GET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(100)
#define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101)
#define IOCTL_HID_GET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(102)
#define IOCTL_HID_SET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(103)
#define IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(104)
#define IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(105)
#define IOCTL_HID_GET_COLLECTION_INFORMATION HID_BUFFER_CTL_CODE(106)
#define IOCTL_HID_GET_COLLECTION_DESCRIPTOR HID_CTL_CODE(100)
#define IOCTL_HID_FLUSH_QUEUE HID_CTL_CODE(101)
#define IOCTL_HID_SET_FEATURE HID_IN_CTL_CODE(100)
#if (NTDDI_VERSION >= NTDDI_WINXP)
#define IOCTL_HID_SET_OUTPUT_REPORT HID_IN_CTL_CODE(101)
#endif
#define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
#define IOCTL_GET_PHYSICAL_DESCRIPTOR HID_OUT_CTL_CODE(102)
#define IOCTL_HID_GET_HARDWARE_ID HID_OUT_CTL_CODE(103)
#if (NTDDI_VERSION >= NTDDI_WINXP)
#define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104)
#endif
/*
* No more IOCTL_HID_GET_FRIENDLY_NAME - use one of the following:
*/
#define IOCTL_HID_GET_MANUFACTURER_STRING HID_OUT_CTL_CODE(110)
#define IOCTL_HID_GET_PRODUCT_STRING HID_OUT_CTL_CODE(111)
#define IOCTL_HID_GET_SERIALNUMBER_STRING HID_OUT_CTL_CODE(112)
#define IOCTL_HID_GET_INDEXED_STRING HID_OUT_CTL_CODE(120)
#if (NTDDI_VERSION >= NTDDI_WINXP)
#define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121)
#define IOCTL_HID_ENABLE_SECURE_READ HID_CTL_CODE(130)
#define IOCTL_HID_DISABLE_SECURE_READ HID_CTL_CODE(131)
#endif
/*
* This is used to pass write-report and feature-report information
* from HIDCLASS to a minidriver.
*/
typedef struct _HID_XFER_PACKET {
PUCHAR reportBuffer;
ULONG reportBufferLen;
UCHAR reportId;
} HID_XFER_PACKET, *PHID_XFER_PACKET;
#ifdef NT_INCLUDED
enum DeviceObjectState {
DeviceObjectStarted,
DeviceObjectStopped,
DeviceObjectRemoved
};
typedef
VOID
(*PHID_STATUS_CHANGE)(
__in PVOID Context,
__in enum DeviceObjectState State
);
typedef struct _HID_INTERFACE_NOTIFY_PNP
{
#ifndef __cplusplus
INTERFACE;
#else
INTERFACE i;
#endif
PHID_STATUS_CHANGE StatusChangeFn;
PVOID CallbackContext;
} HID_INTERFACE_NOTIFY_PNP, *PHID_INTERFACE_NOTIFY_PNP;
#ifdef __HIDPI_H__
__checkReturn
typedef
NTSTATUS
(__stdcall *PHIDP_GETCAPS) (
__in PHIDP_PREPARSED_DATA PreparsedData,
__out PHIDP_CAPS Capabilities
);
typedef struct _HID_INTERFACE_HIDPARSE
{
#ifndef __cplusplus
INTERFACE;
#else
INTERFACE i;
#endif
PHIDP_GETCAPS HidpGetCaps;
} HID_INTERFACE_HIDPARSE, *PHID_INTERFACE_HIDPARSE;
#endif // __HIDPI_H__
#endif // NT_INCLUDED
//
// Structure passed by IOCTL_HID_GET_COLLECTION_INFORMATION
//
typedef struct _HID_COLLECTION_INFORMATION {
//
// DescriptorSize is the size of the input buffer required to accept
// the collection descriptor returned by
// IOCTL_HID_GET_COLLECTION_DESCRIPTOR.
//
ULONG DescriptorSize;
//
// Polled is TRUE if this collection is a polled collection.
//
BOOLEAN Polled;
//
// Reserved1 must be set to zero.
//
UCHAR Reserved1[ 1 ];
//
// Vendor ids of this hid device
//
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
//
// Additional fields, if any, will be added at the end of this structure.
//
} HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION;
//
// Structure passed by IOCTL_HID_GET_DRIVER_CONFIG and
// IOCTL_HID_SET_DRIVER_CONFIG
//
typedef struct _HID_DRIVER_CONFIG {
//
// Size must be set to the size of this structure.
//
ULONG Size;
//
// Size of the input report queue (in reports). This value can be set.
//
ULONG RingBufferSize;
} HID_DRIVER_CONFIG, *PHID_DRIVER_CONFIG;
#if _MSC_VER >= 1200
#pragma warning(pop)
#else
#pragma warning(default:4201)
#endif
#endif // __HIDCLASS_H__

View File

@ -0,0 +1,256 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
HIDPDDI.H
Abstract:
This module contains the PUBLIC definitions for the
code that implements the driver side of the parsing library.
Environment:
Kernel mode
--*/
#ifndef _HIDPDDI_H
#define _HIDPDDI_H
#include "hidusage.h"
#include "hidpi.h"
typedef struct _HIDP_COLLECTION_DESC
{
USAGE UsagePage;
USAGE Usage;
UCHAR CollectionNumber;
UCHAR Reserved [15]; // Must be zero
USHORT InputLength;
USHORT OutputLength;
USHORT FeatureLength;
USHORT PreparsedDataLength;
PHIDP_PREPARSED_DATA PreparsedData;
} HIDP_COLLECTION_DESC, *PHIDP_COLLECTION_DESC;
typedef struct _HIDP_REPORT_IDS
{
UCHAR ReportID;
UCHAR CollectionNumber;
USHORT InputLength;
USHORT OutputLength;
USHORT FeatureLength;
} HIDP_REPORT_IDS, *PHIDP_REPORT_IDS;
typedef struct _HIDP_GETCOLDESC_DBG
{
ULONG BreakOffset;
ULONG ErrorCode;
ULONG Args[6];
} HIDP_GETCOLDESC_DBG, *PHIDP_GETCOLDESC_DBG;
typedef struct _HIDP_DEVICE_DESC
{
PHIDP_COLLECTION_DESC CollectionDesc; // Array allocated By Parser
ULONG CollectionDescLength;
PHIDP_REPORT_IDS ReportIDs; // Array allocated By Parsre
ULONG ReportIDsLength;
HIDP_GETCOLDESC_DBG Dbg;
} HIDP_DEVICE_DESC, *PHIDP_DEVICE_DESC;
__checkReturn
__drv_at(DeviceDescription->CollectionDes, __drv_when(return==0, __drv_allocatesMem(Mem)))
__drv_at(DeviceDescription->ReportIDs, __drv_when(return==0, __drv_allocatesMem(Mem)))
NTSTATUS
HidP_GetCollectionDescription (
__in_bcount(DescLength) PHIDP_REPORT_DESCRIPTOR ReportDesc,
__in ULONG DescLength,
__in POOL_TYPE PoolType,
__out PHIDP_DEVICE_DESC DeviceDescription
);
/*++
Routine Description:
Given a RAW report descriptor, this function fills in the DeviceDescription
block with a linked list of collection descriptors and the corresponding
report ID information that is described by the given report descriptor.
The memory for the collection information and the ReportID information is
allocated from PoolType.
Arguments:
ReportDesc the raw report descriptor.
DescLength the length of the report descriptor.
PoolType pool type from which to allocate the linked lists
DeviceDescription device description block that will be filled in
with the above lists
Return Value:
STATUS_SUCCESS -- if there were no errors which parsing
the report descriptor and allocating the
memory blocks necessary to describe the
device.
STATUS_NO_DATA_DETECTED -- if there were no top-level collections
in the report descriptor
STATUS_COULD_NOT_INTERPRET -- if an error was detected in the report
descriptor. see the error code as set in
Dbg field of the device description block
for more information on the parsing error
STATUS_BUFFER_TOO_SMALL -- if while parsing an item, the function
hits the end of the report descriptor
when it expects more data to exist
STATUS_INSUFFICIENT_RESOURCES -- if a memory allocation failed
STATUS_ILLEGAL_INSTRUCTION -- if there is an item in the report
descriptor that is not recognized
by the parser
HIDP_STATUS_INVALID_REPORT_TYPE -- if a report ID of zero was found in the
descriptor
--*/
__drv_at(DeviceDescription->CollectionDesc, __drv_freesMem(Mem))
__drv_at(DeviceDescription->ReportIDs, __drv_freesMem(Mem))
VOID
HidP_FreeCollectionDescription (
__in PHIDP_DEVICE_DESC DeviceDescription
);
/*++
Routine Description:
This function frees the resources in DeviceDescription that were
allocated by HidP_GetCollectionDescription. It does not, however,
free the the DeviceDescription block itself.
Arguments:
DeviceDescription HIDP_DEVICE_DESC block that was previously filled
in by a call to HidP_GetCollectionDescription
--*/
//
// HIDP_POWER_EVENT is an entry point into hidparse.sys that will answer the
// Power iocontrol "IOCTL_GET_SYS_BUTTON_EVENT".
//
// HidPacket is the from the device AFTER modifying to add the
// obligatory report ID. Remember that in order to use this parser the data
// from the device must be formated such that if the device does not return a
// report ID as the first byte that the report is appended to a report id byte
// of zero.
//
__checkReturn
NTSTATUS
HidP_SysPowerEvent (
__in_bcount(HidPacketLength) PCHAR HidPacket,
__in USHORT HidPacketLength,
__in PHIDP_PREPARSED_DATA Ppd,
__out PULONG OutputBuffer
);
//
// HIDP_POWER_CAPS answers IOCTL_GET_SYS_POWER_BUTTON_CAPS
//
__checkReturn
NTSTATUS
HidP_SysPowerCaps (
__in PHIDP_PREPARSED_DATA Ppd,
__out PULONG OutputBuffer
);
#define HIDP_GETCOLDESC_SUCCESS 0x00
#define HIDP_GETCOLDESC_RESOURCES 0x01
// Insufficient resources to allocate needed memory.
#define HIDP_GETCOLDESC_BUFFER 0x02
#define HIDP_GETCOLDESC_LINK_RESOURCES 0x03
#define HIDP_GETCOLDESC_UNEXP_END_COL 0x04
// An extra end collection token was found.
#define HIDP_GETCOLDESC_PREPARSE_RESOURCES 0x05
// Insufficient resources to allocate memory for preparsing.
#define HIDP_GETCOLDESC_ONE_BYTE 0x06
#define HIDP_GETCOLDESC_TWO_BYTE 0x07
#define HIDP_GETCOLDESC_FOUR_BYTE 0x08
// One two and four more byte were expected but not found.
#define HIDP_GETCOLDESC_BYTE_ALLIGN 0x09
// A given report was not byte aligned
// Args[0] -- Collection number of the offending collection
// Args[1] -- Report ID of offending report
// Args[2] -- Length (in bits) of the Input report for this ID
// Args[3] -- Length (in bits) of the Output report for this ID
// Args[4] -- Length (in bits) of the Feature report for this ID
#define HIDP_GETCOLDESC_MAIN_ITEM_NO_USAGE 0x0A
// A non constant main item was declaired without a corresponding usage.
// Only constant main items (used as padding) are allowed with no usage
#define HIDP_GETCOLDESC_TOP_COLLECTION_USAGE 0x0B
// A top level collection (Arg[0]) was declared without a usage or with
// more than one usage
// Args[0] -- Collection number of the offending collection
#define HIDP_GETCOLDESC_PUSH_RESOURCES 0x10
// Insufficient resources required to push more items to either the global
// items stack or the usage stack
#define HIDP_GETCOLDESC_ITEM_UNKNOWN 0x12
// An unknown item was found in the report descriptor
// Args[0] -- The item value of the unknown item
#define HIDP_GETCOLDESC_REPORT_ID 0x13
// Report ID declaration found outside of top level collection. Report ID's
// must be defined within the context of a top level collection
// Args[0] -- Report ID of the offending report
#define HIDP_GETCOLDESC_BAD_REPORT_ID 0x14
// A bad report ID value was found...Report IDs must be within the range
// of 1-255
#define HIDP_GETCOLDESC_NO_REPORT_ID 0x15
// The parser discovered a top level collection in a complex device (more
// than one top level collection) that had no declared report ID or a
// report ID spanned multiple collections
// Args[0] -- Collection number of the offending collection
#define HIDP_GETCOLDESC_DEFAULT_ID_ERROR 0x16
// The parser detected a condition where a main item was declared without
// a global report ID so the default report ID was used. After this main
// item declaration, the parser detected either another main item that had
// an explicitly defined report ID or it detected a second top-level collection
// The default report ID is only allowed for devices with one top-level
// collection and don't have any report IDs explicitly declared.
//
// The parser detects this error upon finding the second collection or upon
// finding the main item declaration with the explicit report ID.
//
// Args[0] -- Contains the collection number being processed when the
// error was detected.
#define HIDP_GETCOLDESC_NO_DATA 0x1A
// No top level collections were found in this device.
#define HIDP_GETCOLDESC_INVALID_MAIN_ITEM 0x1B
// A main item was detected outside of a top level collection.
#define HIDP_GETCOLDESC_NO_CLOSE_DELIMITER 0x20
// A start delimiter token was found with no corresponding end delimiter
#define HIDP_GETCOLDESC_NOT_VALID_DELIMITER 0x21
// The parser detected a non-usage item with a delimiter declaration
// Args[0] -- item code for the offending item
#define HIDP_GETCOLDESC_MISMATCH_OC_DELIMITER 0x22
// The parser detected either a close delimiter without a corresponding open
// delimiter or detected a nested open delimiter
#define HIDP_GETCOLDESC_UNSUPPORTED 0x40
// The given report descriptor was found to have a valid report descriptor
// containing a scenario that this parser does not support.
// For instance, declaring an ARRAY style main item with delimiters.
#endif

View File

@ -0,0 +1,222 @@
/*++
Copyright (c) 1996 Microsoft Corporation
Module Name:
hidmini.h
Abstract
Definitions that are common to all HID minidrivers.
Authors:
Forrest Foltz
Ervin Peretz
Environment:
Kernel mode only
Revision History:
--*/
#ifndef __HIDPORT_H__
#define __HIDPORT_H__
#include <hidclass.h>
//
// HID_MINIDRIVER_REGISTRATION is a packet of information describing the
// HID minidriver to the class driver. It must be filled in by the minidriver
// and passed to the class driver via HidRegisterMinidriver() from the
// minidriver's DriverEntry() routine.
//
typedef struct _HID_MINIDRIVER_REGISTRATION {
//
// Revision must be set to HID_REVISION by the minidriver
//
ULONG Revision;
//
// DriverObject is a pointer to the minidriver's DriverObject that it
// received as a DriverEntry() parameter.
//
PDRIVER_OBJECT DriverObject;
//
// RegistryPath is a pointer to the minidriver's RegistryPath that it
// received as a DriverEntry() parameter.
//
PUNICODE_STRING RegistryPath;
//
// DeviceExtensionSize is the size of the minidriver's per-device
// extension.
//
ULONG DeviceExtensionSize;
//
// Either all or none of the devices driven by a given minidriver are polled.
//
BOOLEAN DevicesArePolled;
UCHAR Reserved[3];
} HID_MINIDRIVER_REGISTRATION, *PHID_MINIDRIVER_REGISTRATION;
//
// HID_DEVICE_EXTENSION is the public part of the device extension of a HID
// functional device object.
//
typedef struct _HID_DEVICE_EXTENSION {
//
// PhysicalDeviceObject... normally IRPs are not passed to this.
//
PDEVICE_OBJECT PhysicalDeviceObject;
//
// NextDeviceObject... IRPs are sent here by the minidriver. Note that
// NextDeviceObject and PhysicalDeviceObject are the same unless someone
// has inserted a 'filter' device object, in which case they are not the
// same. Sending IRPs to NextDeviceObject will hit the filter device
// objects on the way down.
//
PDEVICE_OBJECT NextDeviceObject;
//
// MiniDeviceExtension is the per-device extension area for use by
// the minidriver. It's size is determined by the DeviceExtensionSize
// parameter passed in to HidAddDevice().
//
// So, given a Functional Device Object, a mininidriver finds this
// structure by:
//
// HidDeviceExtension = (PHID_DEVICE_EXTENSION)(Fdo->DeviceExtension);
//
// And of course it's per-device extension is found by:
//
// MiniDeviceExtension = HidDeviceExtension->MiniDeviceExtension;
//
PVOID MiniDeviceExtension;
} HID_DEVICE_EXTENSION, *PHID_DEVICE_EXTENSION;
typedef struct _HID_DEVICE_ATTRIBUTES {
ULONG Size;
//
// sizeof (struct _HID_DEVICE_ATTRIBUTES)
//
//
// Vendor ids of this hid device
//
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
USHORT Reserved[11];
} HID_DEVICE_ATTRIBUTES, * PHID_DEVICE_ATTRIBUTES;
#include <pshpack1.h>
typedef struct _HID_DESCRIPTOR
{
UCHAR bLength;
UCHAR bDescriptorType;
USHORT bcdHID;
UCHAR bCountry;
UCHAR bNumDescriptors;
/*
* This is an array of one OR MORE descriptors.
*/
struct _HID_DESCRIPTOR_DESC_LIST {
UCHAR bReportType;
USHORT wReportLength;
} DescriptorList [1];
} HID_DESCRIPTOR, * PHID_DESCRIPTOR;
#include <poppack.h>
typedef
VOID
(*HID_SEND_IDLE_CALLBACK)(
__in PVOID Context
);
typedef struct _HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO {
HID_SEND_IDLE_CALLBACK IdleCallback;
PVOID IdleContext;
} HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO, *PHID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO;
//
// Function prototypes for the HID services exported by the hid class driver
// follow.
//
__drv_maxIRQL(APC_LEVEL)
__checkReturn
NTSTATUS
HidRegisterMinidriver(
__in PHID_MINIDRIVER_REGISTRATION MinidriverRegistration
);
#if(NTDDI_VERSION>=NTDDI_WINXPSP1) // Available on XP XP1 and above
NTSTATUS
HidNotifyPresence(
__in PDEVICE_OBJECT DeviceObject,
__in BOOLEAN IsPresent
);
#endif
//
// Internal IOCTLs for the class/mini driver interface.
//
#define IOCTL_HID_GET_DEVICE_DESCRIPTOR HID_CTL_CODE(0)
#define IOCTL_HID_GET_REPORT_DESCRIPTOR HID_CTL_CODE(1)
#define IOCTL_HID_READ_REPORT HID_CTL_CODE(2)
#define IOCTL_HID_WRITE_REPORT HID_CTL_CODE(3)
#define IOCTL_HID_GET_STRING HID_CTL_CODE(4)
#define IOCTL_HID_ACTIVATE_DEVICE HID_CTL_CODE(7)
#define IOCTL_HID_DEACTIVATE_DEVICE HID_CTL_CODE(8)
#define IOCTL_HID_GET_DEVICE_ATTRIBUTES HID_CTL_CODE(9)
#define IOCTL_HID_SEND_IDLE_NOTIFICATION_REQUEST HID_CTL_CODE(10)
/*
* Codes for HID-specific descriptor types, from HID USB spec.
*/
#define HID_HID_DESCRIPTOR_TYPE 0x21
#define HID_REPORT_DESCRIPTOR_TYPE 0x22
#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 // for body part associations
/*
* These are string IDs for use with IOCTL_HID_GET_STRING
* They match the string field offsets in Chapter 9 of the USB Spec.
*/
#define HID_STRING_ID_IMANUFACTURER 14
#define HID_STRING_ID_IPRODUCT 15
#define HID_STRING_ID_ISERIALNUMBER 16
#endif // __HIDPORT_H__

View File

@ -0,0 +1,295 @@
/*
* HintsDeviceService.h
*
* Contains definitions of the Hints Device Service
*
* Copyright (c) Microsoft Corporation, All Rights Reserved.
*
*/
#ifndef _HINTSDEVICESERVICE_H_
#define _HINTSDEVICESERVICE_H_
#include <DeviceServices.h>
/*****************************************************************************/
/* Hints Service Info */
/*****************************************************************************/
DEFINE_DEVSVCGUID(SERVICE_Hints,
0xc8a98b1f, 0x6b19, 0x4e79, 0xa4, 0x14, 0x67, 0xea, 0x4c, 0x39, 0xee, 0xc2);
#define NAME_HintsSvc L"Hints"
#define TYPE_HintsSvc DEVSVCTYPE_DEFAULT
/*****************************************************************************/
/* WPD Content Types */
/*****************************************************************************/
/* WPDCONTENTTYPE_Folder
*
* Indicates this object is a folder.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Folder,
0x27E2E392, 0xA111, 0x48E0, 0xAB, 0x0C, 0xE1, 0x77, 0x05, 0xA0, 0x5F, 0x85);
/* WPDCONTENTTYPE_Image
*
* Indicates this object represents image data (e.g. a JPEG file)
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Image,
0xef2107d5, 0xa52a, 0x4243, 0xa2, 0x6b, 0x62, 0xd4, 0x17, 0x6d, 0x76, 0x03);
/* WPDCONTENTTYPE_Document
*
* Indicates this object represents document data (e.g. a MS WORD file,
* TEXT file, etc.)
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Document,
0x680ADF52, 0x950A, 0x4041, 0x9B, 0x41, 0x65, 0xE3, 0x93, 0x64, 0x81, 0x55);
/* WPDCONTENTTYPE_Contact
*
* Indicates this object represents contact data (e.g. name/number, or a
* VCARD file)
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Contact,
0xEABA8313, 0x4525, 0x4707, 0x9F, 0x0E, 0x87, 0xC6, 0x80, 0x8E, 0x94, 0x35);
/* WPDCONTENTTYPE_ContactGroup
*
* Indicates this object represents a group of contacts.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_ContactGroup,
0x346B8932, 0x4C36, 0x40D8, 0x94, 0x15, 0x18, 0x28, 0x29, 0x1F, 0x9D, 0xE9);
/* WPDCONTENTTYPE_Audio
*
* Indicates this object represents audio data (e.g. a WMA or MP3 file)
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Audio,
0x4AD2C85E, 0x5E2D, 0x45E5, 0x88, 0x64, 0x4F, 0x22, 0x9E, 0x3C, 0x6C, 0xF0);
/* WPDCONTENTTYPE_Video
*
* Indicates this object represents video data (e.g. a WMV or AVI file)
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Video,
0x9261B03C, 0x3D78, 0x4519, 0x85, 0xE3, 0x02, 0xC5, 0xE1, 0xF5, 0x0B, 0xB9);
/* WPDCONTENTTYPE_Television
*
* Indicates this object represents a television recording.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Television,
0x60A169CF, 0xF2AE, 0x4E21, 0x93, 0x75, 0x96, 0x77, 0xF1, 0x1C, 0x1C, 0x6E);
/* WPDCONTENTTYPE_Playlist
*
* Indicates this object represents a playlist.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Playlist,
0x1A33F7E4, 0xAF13, 0x48F5, 0x99, 0x4E, 0x77, 0x36, 0x9D, 0xFE, 0x04, 0xA3);
/* WPDCONTENTTYPE_MixedContentAlbum
*
* Indicates this object represents an album, which may contain objects of
* different content types (typically, MUSIC, IMAGE and VIDEO).
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_MixedContentAlbum,
0x00F0C3AC, 0xA593, 0x49AC, 0x92, 0x19, 0x24, 0xAB, 0xCA, 0x5A, 0x25, 0x63);
/* WPDCONTENTTYPE_AudioAlbum
*
* Indicates this object represents an audio album.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_AudioAlbum,
0xAA18737E, 0x5009, 0x48FA, 0xAE, 0x21, 0x85, 0xF2, 0x43, 0x83, 0xB4, 0xE6);
/* WPDCONTENTTYPE_ImageAlbum
*
* Indicates this object represents an image album.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_ImageAlbum,
0x75793148, 0x15F5, 0x4A30, 0xA8, 0x13, 0x54, 0xED, 0x8A, 0x37, 0xE2, 0x26);
/* WPDCONTENTTYPE_VideoAlbum
*
* Indicates this object represents a video album.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_VideoAlbum,
0x012B0DB7, 0xD4C1, 0x45D6, 0xB0, 0x81, 0x94, 0xB8, 0x77, 0x79, 0x61, 0x4F);
/* WPDCONTENTTYPE_Memo
*
* Indicates this object represents memo data
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Memo,
0x9CD20ECF, 0x3B50, 0x414F, 0xA6, 0x41, 0xE4, 0x73, 0xFF, 0xE4, 0x57, 0x51);
/* WPDCONTENTTYPE_Email
*
* Indicates this object represents e-mail data
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Email,
0x8038044A, 0x7E51, 0x4F8F, 0x88, 0x3D, 0x1D, 0x06, 0x23, 0xD1, 0x45, 0x33);
/* WPDCONTENTTYPE_Appointment
*
* Indicates this object represents an appointment in a calendar
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Appointment,
0x0FED060E, 0x8793, 0x4B1E, 0x90, 0xC9, 0x48, 0xAC, 0x38, 0x9A, 0xC6, 0x31);
/* WPDCONTENTTYPE_Task
*
* Indicates this object represents a task for tracking (e.g. a TODO list)
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Task,
0x63252F2C, 0x887F, 0x4CB6, 0xB1, 0xAC, 0xD2, 0x98, 0x55, 0xDC, 0xEF, 0x6C);
/* WPDCONTENTTYPE_Program
*
* Indicates this object represents a file that can be run. This could be a
* script, executable and so on.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Program,
0xD269F96A, 0x247C, 0x4BFF, 0x98, 0xFB, 0x97, 0xF3, 0xC4, 0x92, 0x20, 0xE6);
/* WPDCONTENTTYPE_GenericFile
*
* Indicates this object represents a file that does not fall into any of the
* other predefined WPD types for files.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_GenericFile,
0x0085E0A6, 0x8D34, 0x45D7, 0xBC, 0x5C, 0x44, 0x7E, 0x59, 0xC7, 0x3D, 0x48);
/* WPDCONTENTTYPE_Calendar
*
* Indicates this object represents a calender
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Calendar,
0xA1FD5967, 0x6023, 0x49A0, 0x9D, 0xF1, 0xF8, 0x06, 0x0B, 0xE7, 0x51, 0xB0);
/* WPDCONTENTTYPE_GenericMessage
*
* Indicates this object represents a message (e.g. SMS message,
* E-Mail message, etc.)
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_GenericMessage,
0xE80EAAF8, 0xB2DB, 0x4133, 0xB6, 0x7E, 0x1B, 0xEF, 0x4B, 0x4A, 0x6E, 0x5F);
/* WPDCONTENTTYPE_NetworkAssociation
*
* Indicates this object represents an association between a host and a device.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_NetworkAssociation,
0x031DA7EE, 0x18C8, 0x4205, 0x84, 0x7E, 0x89, 0xA1, 0x12, 0x61, 0xD0, 0xF3);
/* WPDCONTENTTYPE_Certificate
*
* Indicates this object represents certificate used for authentication.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Certificate,
0xDC3876E8, 0xA948, 0x4060, 0x90, 0x50, 0xCB, 0xD7, 0x7E, 0x8A, 0x3D, 0x87);
/* WPDCONTENTTYPE_WirelessProfile
*
* Indicates this object represents wireless network access information.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_WirelessProfile,
0x0BAC070A, 0x9F5F, 0x4DA4, 0xA8, 0xF6, 0x3D, 0xE4, 0x4D, 0x68, 0xFD, 0x6C);
/* WPDCONTENTTYPE_MediaCast
*
* Indicates this object represents a media cast. A media cast object can be
* thought of as a container object that groups related content, similar to
* how a playlist groups songs to play. Often, a media cast object is used
* to group media content originally published online.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_MediaCast,
0x5E88B3CC, 0x3E65, 0x4E62, 0xBF, 0xFF, 0x22, 0x94, 0x95, 0x25, 0x3A, 0xB0);
/* WPDCONTENTTYPE_Section
*
* Indicates this object describes a section of data contained in another
* object. The WPD_OBJECT_REFERENCES property indicates which object contains
* the actual data.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Section,
0x821089F5, 0x1D91, 0x4DC9, 0xBE, 0x3C, 0xBB, 0xB1, 0xB3, 0x5B, 0x18, 0xCE);
/* WPDCONTENTTYPE_Unspecified
*
* Indicates this object doesn't fall into the predefined WPD content types
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_Unspecified,
0x28D8D31E, 0x249C, 0x454E, 0xAA, 0xBC, 0x34, 0x88, 0x31, 0x68, 0xE6, 0x34);
/* WPDCONTENTTYPE_All
*
* This content type is only valid as a parameter to API functions and driver
* commands. It should not be reported as a supported content type by the driver.
*/
DEFINE_DEVSVCGUID(WPDCONTENTTYPE_All,
0x80E170D2, 0x1055, 0x4A3E, 0xB9, 0x52, 0x82, 0xCC, 0x4F, 0x8A, 0x86, 0x89);
#endif /* _HINTSDEVICESERVICE_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,162 @@
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//==========================================================================;
#if 0
To access the IO functionality in a WDM driver or the VDD, WDM driver sends
the following IRP to its parent.
MajorFunction = IRP_MJ_PNP;
MinorFunction = IRP_MN_QUERY_INTERFACE;
Guid = DEFINE_GUID( GUID_GPIO_INTERFACE,
0x02295e87L, 0xbb3f, 0x11d0, 0x80, 0xce, 0x0, 0x20, 0xaf, 0xf7, 0x49, 0x1e);
The QUERY_INTERFACE Irp will return an interface (set of function pointers)
of the type xxxxINTERFACE, defined below. This is essentially a table of
function pointers.
#endif
#ifndef __I2CGPIO_H__
#define __I2CGPIO_H__
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Guids
//
// DEFINE_GUID requires that you include wdm.h before this file.
// #define INITGUID to actually initialize the guid in memory.
//
DEFINE_GUID( GUID_I2C_INTERFACE, 0x02295e86L, 0xbb3f, 0x11d0, 0x80, 0xce, 0x0, 0x20, 0xaf, 0xf7, 0x49, 0x1e);
DEFINE_GUID( GUID_GPIO_INTERFACE,0x02295e87L, 0xbb3f, 0x11d0, 0x80, 0xce, 0x0, 0x20, 0xaf, 0xf7, 0x49, 0x1e);
DEFINE_GUID( GUID_COPYPROTECTION_INTERFACE, 0x02295e88L, 0xbb3f, 0x11d0, 0x80, 0xce, 0x0, 0x20, 0xaf, 0xf7, 0x49, 0x1e);
//==========================================================================;
// used below if neccessary
#ifndef BYTE
#define BYTE UCHAR
#endif
#ifndef DWORD
#define DWORD ULONG
#endif
//==========================================================================;
//
// I2C section
//
// I2C Commands
#define I2C_COMMAND_NULL 0X0000
#define I2C_COMMAND_READ 0X0001
#define I2C_COMMAND_WRITE 0X0002
#define I2C_COMMAND_STATUS 0X0004
#define I2C_COMMAND_RESET 0X0008
// The following flags are provided on a READ or WRITE command
#define I2C_FLAGS_START 0X0001 // START + addx
#define I2C_FLAGS_STOP 0X0002 // STOP
#define I2C_FLAGS_DATACHAINING 0X0004 // STOP, START + addx
#define I2C_FLAGS_ACK 0X0010 // ACKNOWLEDGE (normally set)
// The following status flags are returned on completion of the operation
#define I2C_STATUS_NOERROR 0X0000
#define I2C_STATUS_BUSY 0X0001
#define I2C_STATUS_ERROR 0X0002
typedef struct _I2CControl {
ULONG Command; // I2C_COMMAND_*
DWORD dwCookie; // Context identifier returned on Open
BYTE Data; // Data to write, or returned byte
BYTE Reserved[3]; // Filler
ULONG Flags; // I2C_FLAGS_*
ULONG Status; // I2C_STATUS_*
ULONG ClockRate; // Bus clockrate in Hz.
} I2CControl, *PI2CControl;
// this is the Interface definition for I2C
//
typedef NTSTATUS (STDMETHODCALLTYPE *I2COPEN)(PDEVICE_OBJECT, ULONG, PI2CControl);
typedef NTSTATUS (STDMETHODCALLTYPE *I2CACCESS)(PDEVICE_OBJECT, PI2CControl);
typedef struct {
INTERFACE _vddInterface;
I2COPEN i2cOpen;
I2CACCESS i2cAccess;
} I2CINTERFACE;
//==========================================================================;
//
// GPIO section
//
// GPIO Commands
#define GPIO_COMMAND_QUERY 0X0001 // get #pins and nBufferSize
#define GPIO_COMMAND_OPEN 0X0001 // old open
#define GPIO_COMMAND_OPEN_PINS 0X0002 // get dwCookie
#define GPIO_COMMAND_CLOSE_PINS 0X0004 // invalidate cookie
#define GPIO_COMMAND_READ_BUFFER 0X0008
#define GPIO_COMMAND_WRITE_BUFFER 0X0010
// The following flags are provided on a READ_BUFFER or WRITE_BUFFER command
// lpPins bits set MUST have contiguous bits set for a read/write command.
//
// On a READ, if the number of pins set in the bitmask does not fill a
// byte/word/dword, then zeros are returned for those positions.
// on a WRITE, if the number of pins set in the bitmask does not fill a
// byte/word/dword, a read/modify/write is done on the port/mmio position
// that represents those bits.
#define GPIO_FLAGS_BYTE 0x0001 // do byte read/write
#define GPIO_FLAGS_WORD 0x0002 // do word read/write
#define GPIO_FLAGS_DWORD 0x0004 // do dword read/write
// The following status flags are returned on completion of the operation
#define GPIO_STATUS_NOERROR 0X0000
#define GPIO_STATUS_BUSY 0X0001
#define GPIO_STATUS_ERROR 0X0002
#define GPIO_STATUS_NO_ASYNCH 0X0004 // gpio provider does not do asynch xfer
typedef struct _GPIOControl {
ULONG Command; // GPIO_COMMAND_*
ULONG Flags; // GPIO_FLAGS_*
DWORD dwCookie; // Context identifier returned on Open
ULONG Status; // GPIO_STATUS_*
ULONG nBytes; // # of bytes to send or recieved
ULONG nBufferSize; // max size of buffer
ULONG nPins; // number of GPIO pins returned by Open
UCHAR *Pins; // pointer to bitmask of pins to read/write
UCHAR *Buffer; // pointer to GPIO data to send/recieve
void (*AsynchCompleteCallback)(UCHAR *Buffer);
// NULL if synchronous xfer, valid ptr if asynch.
GUID PrivateInterfaceType;
void (*PrivateInterface)();
} GPIOControl, *PGPIOControl;
// This is the GPIO interface
//
typedef NTSTATUS (STDMETHODCALLTYPE *GPIOOPEN)(PDEVICE_OBJECT, ULONG, PGPIOControl);
typedef NTSTATUS (STDMETHODCALLTYPE *GPIOACCESS)(PDEVICE_OBJECT, PGPIOControl);
typedef struct {
INTERFACE _vddInterface;
GPIOOPEN gpioOpen;
GPIOACCESS gpioAccess;
} GPIOINTERFACE;
//==========================================================================;
#ifdef __cplusplus
}
#endif // __cplusplus
#endif //__I2CGPIO_H__

Some files were not shown because too many files have changed in this diff Show More